diff --git a/README.md b/README.md index 06b7254..62ed2ae 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The wrapper is currently compliant with ArrayFire 3.2 API (and higher). If you f ## Example ```lua -local AF = require("af_lib") +local AF = require("arrayfire") AF.main(function() local x = AF.randu(5, "f32") diff --git a/examples/lua/benchmarks/blas.lua b/examples/lua/benchmarks/blas.lua index 23faa41..1a6602f 100644 --- a/examples/lua/benchmarks/blas.lua +++ b/examples/lua/benchmarks/blas.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- create a small wrapper to benchmark local A -- populated before each timing diff --git a/examples/lua/benchmarks/fft.lua b/examples/lua/benchmarks/fft.lua index c7535fc..3a1ff94 100644 --- a/examples/lua/benchmarks/fft.lua +++ b/examples/lua/benchmarks/fft.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- create a small wrapper to benchmark local A -- populated before each timing diff --git a/examples/lua/benchmarks/pi.lua b/examples/lua/benchmarks/pi.lua index d972773..993b8f8 100644 --- a/examples/lua/benchmarks/pi.lua +++ b/examples/lua/benchmarks/pi.lua @@ -19,7 +19,7 @@ local random = math.random local sqrt = math.sqrt -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- generate millions of random samples local samples = 20e6 diff --git a/examples/lua/financial/black_scholes_options.lua b/examples/lua/financial/black_scholes_options.lua index 54a5c98..9cbaef4 100644 --- a/examples/lua/financial/black_scholes_options.lua +++ b/examples/lua/financial/black_scholes_options.lua @@ -11,7 +11,7 @@ -- Modules -- local input = require("financial.input") -local AF = require("af_lib") +local AF = require("arrayfire") -- -- local sqrt2 = math.sqrt(2) diff --git a/examples/lua/financial/heston_model.lua b/examples/lua/financial/heston_model.lua index dd308b6..44a2070 100644 --- a/examples/lua/financial/heston_model.lua +++ b/examples/lua/financial/heston_model.lua @@ -36,7 +36,7 @@ local exp = math.exp local sqrt = math.sqrt -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") print("") print("N.B. THIS IS A WIP") diff --git a/examples/lua/financial/monte_carlo_options.lua b/examples/lua/financial/monte_carlo_options.lua index e1cfe81..a0d1575 100644 --- a/examples/lua/financial/monte_carlo_options.lua +++ b/examples/lua/financial/monte_carlo_options.lua @@ -14,7 +14,7 @@ local exp = math.exp local sqrt = math.sqrt -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- Shorthands -- local Comp, WC = AF.CompareResult, AF.WrapConstant diff --git a/examples/lua/getting_started/convolve.lua b/examples/lua/getting_started/convolve.lua index 45f4664..9df0393 100644 --- a/examples/lua/getting_started/convolve.lua +++ b/examples/lua/getting_started/convolve.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local lib = require("af_lib") +local lib = require("arrayfire") lib.main(function() -- 5x5 derivative with separable kernels diff --git a/examples/lua/getting_started/integer.lua b/examples/lua/getting_started/integer.lua index be824bb..8cd6384 100644 --- a/examples/lua/getting_started/integer.lua +++ b/examples/lua/getting_started/integer.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") print("") print("N.B. THIS IS A WIP") diff --git a/examples/lua/getting_started/rainfall.lua b/examples/lua/getting_started/rainfall.lua index 40a4c0e..d2e8f3b 100644 --- a/examples/lua/getting_started/rainfall.lua +++ b/examples/lua/getting_started/rainfall.lua @@ -25,7 +25,7 @@ print("") -- note: example adapted from -- "Rapid Problem Solving Using Thrust", Nathan Bell, NVIDIA -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- Shorthands -- local Comp, WC = AF.CompareResult, AF.WrapConstant diff --git a/examples/lua/graphics/conway.lua b/examples/lua/graphics/conway.lua index b0fe934..813a4f8 100644 --- a/examples/lua/graphics/conway.lua +++ b/examples/lua/graphics/conway.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- Shorthands -- local Comp, WC = AF.CompareResult, AF.WrapConstant diff --git a/examples/lua/graphics/conway_pretty.lua b/examples/lua/graphics/conway_pretty.lua index 0416ca7..0495d40 100644 --- a/examples/lua/graphics/conway_pretty.lua +++ b/examples/lua/graphics/conway_pretty.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- Shorthands -- local Comp, WC = AF.CompareResult, AF.WrapConstant diff --git a/examples/lua/graphics/fractal.lua b/examples/lua/graphics/fractal.lua index 8f7ae40..60ce592 100644 --- a/examples/lua/graphics/fractal.lua +++ b/examples/lua/graphics/fractal.lua @@ -14,7 +14,7 @@ local abs = math.abs local sqrt = math.sqrt -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- Shorthands -- local Comp, WC = AF.CompareResult, AF.WrapConstant diff --git a/examples/lua/graphics/histogram.lua b/examples/lua/graphics/histogram.lua index bdbaa60..a2d760d 100644 --- a/examples/lua/graphics/histogram.lua +++ b/examples/lua/graphics/histogram.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") AF.main(function() local myWindow = AF.Window(512, 512, "Histogram example using ArrayFire") diff --git a/examples/lua/graphics/plot2d.lua b/examples/lua/graphics/plot2d.lua index 191ce85..037ba80 100644 --- a/examples/lua/graphics/plot2d.lua +++ b/examples/lua/graphics/plot2d.lua @@ -13,7 +13,7 @@ local pi = math.pi -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") -- local ITERATIONS = 100 diff --git a/examples/lua/graphics/plot3d.lua b/examples/lua/graphics/plot3d.lua index 7529857..5b7fe29 100644 --- a/examples/lua/graphics/plot3d.lua +++ b/examples/lua/graphics/plot3d.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") local ITERATIONS = 200 local PRECISION = 1.0/ITERATIONS diff --git a/examples/lua/graphics/surface.lua b/examples/lua/graphics/surface.lua index 54d39a0..e13572d 100644 --- a/examples/lua/graphics/surface.lua +++ b/examples/lua/graphics/surface.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") print("") print("N.B. THIS IS A WIP") diff --git a/examples/lua/helloworld/helloworld.lua b/examples/lua/helloworld/helloworld.lua index 5d5ea54..f42c9c4 100644 --- a/examples/lua/helloworld/helloworld.lua +++ b/examples/lua/helloworld/helloworld.lua @@ -10,7 +10,7 @@ --]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") AF.main(function() print("Create a 5-by-3 matrix of random floats on the GPU") diff --git a/examples/lua/helloworld/intro.lua b/examples/lua/helloworld/intro.lua index 99ca172..4eb65ac 100644 --- a/examples/lua/helloworld/intro.lua +++ b/examples/lua/helloworld/intro.lua @@ -9,7 +9,7 @@ ********************************************************/ --]] -local AF = require("af_lib") +local AF = require("arrayfire") AF.main(function() local x = AF.randu(5, "f32") diff --git a/examples/lua/lin_algebra/cholesky.lua b/examples/lua/lin_algebra/cholesky.lua index 2c1a656..8344912 100644 --- a/examples/lua/lin_algebra/cholesky.lua +++ b/examples/lua/lin_algebra/cholesky.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") AF.main(function() local n = 5 diff --git a/examples/lua/lin_algebra/lu.lua b/examples/lua/lin_algebra/lu.lua index 1f610ad..e1ce5a5 100644 --- a/examples/lua/lin_algebra/lu.lua +++ b/examples/lua/lin_algebra/lu.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") AF.main(function() local in_arr = AF.randu(5, 8) diff --git a/examples/lua/lin_algebra/qr.lua b/examples/lua/lin_algebra/qr.lua index ebeffb3..739fb4a 100644 --- a/examples/lua/lin_algebra/qr.lua +++ b/examples/lua/lin_algebra/qr.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") AF.main(function() print("Running QR InPlace") diff --git a/examples/lua/lin_algebra/svd.lua b/examples/lua/lin_algebra/svd.lua index 9fd254a..2c5cf8a 100644 --- a/examples/lua/lin_algebra/svd.lua +++ b/examples/lua/lin_algebra/svd.lua @@ -10,7 +10,7 @@ ]] -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") print("") print("N.B. THIS IS A WIP") diff --git a/examples/lua/pde/swe.lua b/examples/lua/pde/swe.lua index 848bc9c..5f73755 100644 --- a/examples/lua/pde/swe.lua +++ b/examples/lua/pde/swe.lua @@ -2,7 +2,7 @@ local floor = math.floor -- Modules -- -local AF = require("af_lib") +local AF = require("arrayfire") AF.main(function(argc, arv) local win diff --git a/lib/af_lib.lua b/lib/arrayfire.lua similarity index 100% rename from lib/af_lib.lua rename to lib/arrayfire.lua diff --git a/lib/funcs/io.lua b/lib/funcs/io.lua index e5bdaae..d289a84 100644 --- a/lib/funcs/io.lua +++ b/lib/funcs/io.lua @@ -1,7 +1,7 @@ --- IO functions. -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") local array = require("impl.array") -- Imports -- diff --git a/lib/funcs/linear_algebra.lua b/lib/funcs/linear_algebra.lua index 5687ebc..2119de6 100644 --- a/lib/funcs/linear_algebra.lua +++ b/lib/funcs/linear_algebra.lua @@ -1,7 +1,7 @@ --- Linear algebra functions. -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") local array = require("impl.array") -- Imports -- diff --git a/lib/funcs/mathematics.lua b/lib/funcs/mathematics.lua index be2e5bf..787152a 100644 --- a/lib/funcs/mathematics.lua +++ b/lib/funcs/mathematics.lua @@ -1,7 +1,7 @@ --- Mathematics functions. -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") local array = require("impl.array") -- Imports -- diff --git a/lib/funcs/signal_processing.lua b/lib/funcs/signal_processing.lua index 0d2f2f2..ec8c287 100644 --- a/lib/funcs/signal_processing.lua +++ b/lib/funcs/signal_processing.lua @@ -4,7 +4,7 @@ local min = math.min -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") local array = require("impl.array") -- Imports -- diff --git a/lib/graphics/window.lua b/lib/graphics/window.lua index 062ab45..675b9c4 100644 --- a/lib/graphics/window.lua +++ b/lib/graphics/window.lua @@ -6,7 +6,7 @@ local rawequal = rawequal local type = type -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") local array = require("impl.array") -- Imports -- diff --git a/lib/impl/array.lua b/lib/impl/array.lua index eaee0c2..28e2b3e 100644 --- a/lib/impl/array.lua +++ b/lib/impl/array.lua @@ -10,7 +10,7 @@ local traceback = debug and debug.traceback local type = type -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") -- Cached module references -- local _AddToCurrentEnvironment_ @@ -150,8 +150,7 @@ local Lib --- DOCME function M.GetLib () - Lib = Lib or require("af_lib") - + Lib = Lib or require("arrayfire") return Lib end @@ -212,7 +211,7 @@ function M.ToArray (value, other) local btype, hother = type(value), other:get() local ndims = _Call_("af_get_numdims", hother) - Args[1], Args[2], Args[3], Args[4] = _Call_("af_get_dims", hother) + Args[1], Args[2], Args[3], Args[4] = _Call_("af_get_dims", hother) if btype == "table" then -- Complex... @@ -330,4 +329,4 @@ _ToArray_ = M.ToArray _WrapArray_ = M.WrapArray -- Export the module. -return M \ No newline at end of file +return M diff --git a/lib/impl/index.lua b/lib/impl/index.lua index b94fabc..43b6c1a 100644 --- a/lib/impl/index.lua +++ b/lib/impl/index.lua @@ -1,7 +1,7 @@ --- Core index module. -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") -- Forward declarations -- diff --git a/lib/impl/operators.lua b/lib/impl/operators.lua index a34708a..169524a 100644 --- a/lib/impl/operators.lua +++ b/lib/impl/operators.lua @@ -1,7 +1,7 @@ --- Operator overloads. -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") -- Forward declarations -- local CallWrap diff --git a/lib/methods/constructors.lua b/lib/methods/constructors.lua index 60a5e9a..984fea5 100644 --- a/lib/methods/constructors.lua +++ b/lib/methods/constructors.lua @@ -8,7 +8,7 @@ local type = type local unpack = unpack -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") local array = require("impl.array") -- Imports -- diff --git a/lib/methods/device.lua b/lib/methods/device.lua index c888522..6424125 100644 --- a/lib/methods/device.lua +++ b/lib/methods/device.lua @@ -1,7 +1,7 @@ --- Device functions. -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") local array = require("impl.array") -- Imports -- diff --git a/lib/methods/methods.lua b/lib/methods/methods.lua index a199e4a..0f1c242 100644 --- a/lib/methods/methods.lua +++ b/lib/methods/methods.lua @@ -1,7 +1,7 @@ --- Array methods. -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") -- Exports -- local M = {} diff --git a/lib/methods/move_reorder.lua b/lib/methods/move_reorder.lua index b79df71..94661c1 100644 --- a/lib/methods/move_reorder.lua +++ b/lib/methods/move_reorder.lua @@ -4,7 +4,7 @@ local type = type -- Modules -- -local af = require("arrayfire") +local af = require("arrayfire_lib") local array = require("impl.array") -- Imports -- diff --git a/src/Lua/arrayfire/CMakeLists.txt b/src/Lua/arrayfire/CMakeLists.txt index e26d5b4..bef6e08 100644 --- a/src/Lua/arrayfire/CMakeLists.txt +++ b/src/Lua/arrayfire/CMakeLists.txt @@ -49,16 +49,16 @@ ENDIF() INCLUDE_DIRECTORIES(${ArrayFire_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR}) -ADD_LIBRARY(arrayfire SHARED +ADD_LIBRARY(arrayfire_lib SHARED ${src} ${funcs_src} ${graphics_src} ${methods_src}) -TARGET_LINK_LIBRARIES(arrayfire +TARGET_LINK_LIBRARIES(arrayfire_lib ${ArrayFire_Unified_LIBRARIES} ${LUA_LIBRARIES} ) -SET_TARGET_PROPERTIES(arrayfire PROPERTIES +SET_TARGET_PROPERTIES(arrayfire_lib PROPERTIES PREFIX "") diff --git a/src/Lua/arrayfire/arrayfire.cpp b/src/Lua/arrayfire/arrayfire.cpp index b5469b2..ef0cef5 100644 --- a/src/Lua/arrayfire/arrayfire.cpp +++ b/src/Lua/arrayfire/arrayfire.cpp @@ -18,7 +18,7 @@ void Register (lua_State * L, lua_CFunction func) } } -__EXPORT__ int luaopen_arrayfire (lua_State * L) +__EXPORT__ int luaopen_arrayfire_lib (lua_State * L) { lua_createtable(L, 0, 0); // af