-
Notifications
You must be signed in to change notification settings - Fork 1
/
ffi.lua
33 lines (27 loc) · 1.04 KB
/
ffi.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local ffi = require 'ffi'
ffi.cdef[[
void launchPTX(THCState* state, const char* ptx, const char* name, void* args[], int* grid, int* block);
]]
local cdef = [[
bool THCudaTensor_pointwiseApply1(THCState* state,
THCudaTensor* a,
const char* op_string);
bool THCudaTensor_pointwiseApply2(THCState* state,
THCudaTensor* a,
THCudaTensor* b,
const char* op_string);
bool THCudaTensor_pointwiseApply3(THCState* state,
THCudaTensor* a,
THCudaTensor* b,
THCudaTensor* c,
const char* op_string);
]]
for i,v in ipairs{
{'THCudaTensor', 'THCudaHalfTensor'},
{'THCudaTensor', 'THCudaTensor'},
{'THCudaTensor', 'THCudaDoubleTensor'},
} do
local s = cdef:gsub(unpack(v))
ffi.cdef(s)
end
return ffi.load(package.searchpath('libcutorchrtc', package.cpath))