Skip to content

Commit cacbea3

Browse files
committed
Refactoring the repo to use ffi
1 parent 5cd1e77 commit cacbea3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+783
-7495
lines changed

CMakeLists.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

CMakeModules/build_lua.cmake

Lines changed: 0 additions & 76 deletions
This file was deleted.

CMakeModules/lua_MSVC.patch

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 11 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,11 @@
22

33
[ArrayFire](https://github.com/arrayfire/arrayfire) is a high performance library for parallel computing with an easy-to-use API. It enables users to write scientific computing code that is portable across CUDA, OpenCL and CPU devices. This project provides Lua bindings for the ArrayFire library.
44

5-
The wrapper is currently compliant with ArrayFire 3.2 API (and higher). If you find any bugs, please report them [here](https://github.com/arrayfire/arrayfire-lua/issues).
5+
The wrapper is currently compliant with ArrayFire 3.4 API (and higher). If you find any bugs, please report them [here](https://github.com/arrayfire/arrayfire-lua/issues).
66

77
## Example
88

9-
```lua
10-
local AF = require("arrayfire")
11-
12-
AF.main(function()
13-
local x = AF.randu(5, "f32")
14-
AF.print("x", x)
15-
AF.print("min of x", AF.min(x))
16-
AF.print("max of x", AF.max(x))
17-
end)
18-
```
19-
20-
```
21-
$ lua examples/lua/helloworld/intro.lua
22-
ArrayFire v3.2.1 (CUDA, 64-bit Linux, build f263db0)
23-
Platform: CUDA Toolkit 7.5, Driver: 358.16
24-
[0] GeForce GTX 690, 2047 MB, CUDA Compute 3.0
25-
-1- GeForce GTX 690, 2048 MB, CUDA Compute 3.0
26-
27-
x
28-
[5 1 1 1]
29-
0.7402
30-
0.9210
31-
0.0390
32-
0.9690
33-
0.9251
34-
35-
min of x
36-
[1 1 1 1]
37-
0.0390
38-
max of x
39-
[1 1 1 1]
40-
0.9690
41-
42-
```
9+
TODO
4310

4411
## Documentation
4512

@@ -52,6 +19,11 @@ TODO
5219
- `cmake`
5320
- `Visual Studio` on Windows, `clang` / `gcc` on Linux / OSX.
5421

22+
Addiitonally, if you install the following Lua packages:
23+
24+
- [luarocks](https://github.com/keplerproject/luarocks)
25+
- [luaffi](https://github.com/facebook/luaffifb) (Not required for LuaJIT)
26+
5527
### Get ArrayFire libraries
5628

5729
You can install ArrayFire using one of the following two ways.
@@ -65,37 +37,10 @@ You can install ArrayFire using one of the following two ways.
6537

6638
### Building the Lua module
6739

68-
**Windows**
69-
70-
1. Launch `cmake-gui`. Set source and build directories.
71-
2. Press configure.
72-
3. Select `generator` as `Visual Studio 12 2013 Win64`.
73-
- You can choose a different generator as long as it is Win64.
74-
4. Set `CMAKE_INSTALL_PREFIX` to a location of choice.
75-
5. Press generate. The generated visual studio solution file will be present in the build directory.
76-
6. Open the VS solution file and build the `INSTALL` project.
77-
78-
**Linux / OSX**
79-
80-
1. Make sure the environment variable `ArrayFire_DIR` is set to `/path/to/arrayfire/share/ArrayFire/cmake`.
81-
2. Create a build directory and `cd` into it.
82-
3. Run `cmake /path/to/arrayfire-lua/ -DCMAKE_INSTALL_PREFIX=package`.
83-
4. Run `make`
84-
85-
### Setting up Lua paths
86-
87-
**Windows**
88-
89-
> SET LUA_PATH=C:\path\to\install\location\arrayfire\?.lua;;
90-
> SET LUA_CPATH=C:\path\to\install\location\?.dll;;
91-
> lua.exe helloworld/helloworld.lua
92-
93-
**Linux**
94-
95-
$ export LUA_PATH="/path/to/install/location/arrayfire/?.lua;;"
96-
$ export LUA_CPATH="/path/to/install/location/?.so;;"
97-
$ lua helloworld/helloworld.lua
98-
40+
```
41+
cd /path/to/arrayfire-lua/
42+
luarocks make
43+
```
9944

10045
You should now be good to go!
10146

arrayfire-3.4-0.rockspec

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package = "arrayfire"
2+
version = "3.4-0"
3+
source = {
4+
url = "git://github.com/arrayfire/arrayfire-lua",
5+
tag = "master",
6+
dir = "."
7+
}
8+
description = {
9+
summary = "Lua Bindings for ArrayFire",
10+
homepage = "http://github.com/arrayfire",
11+
license = "BSD-3"
12+
}
13+
dependencies = {
14+
"lua >= 5.1, < 5.4",
15+
}
16+
build = {
17+
type = "builtin",
18+
modules = {
19+
arrayfire = "arrayfire.lua",
20+
["arrayfire.lib"] = "arrayfire/lib.lua",
21+
["arrayfire.device"] = "arrayfire/device.lua",
22+
},
23+
}

arrayfire.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require('arrayfire.lib')
2+
require('arrayfire.device')
3+
return af

arrayfire/device.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require('arrayfire.lib')
2+
af.info = function()
3+
af.lib.af_info()
4+
end

0 commit comments

Comments
 (0)