futhark-pycffi
futhark-pycffi copied to clipboard
ISPC missing symbol macOS
Using the ISPC backend I've got a missing symbol (the C backend works fine, and plain futhark bench --backend=ispc bench_epiloss.fut also works),
ImportError Traceback (most recent call last)
/Users/duke/src/tvb-fut/bench_epiloss.ipynb Cell 5 in <cell line: 2>()
1 from futhark_ffi import Futhark
----> 2 import _bench_epiloss
3 epinet = Futhark(_bench_epiloss)
4 w = np.loadtxt('weights.txt').astype('f')
ImportError: dlopen(/Users/duke/src/tvb-fut/_bench_epiloss.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_futhark_mc_loop_ispc_57637)
I'll poke at it, but wanted to report.
This is because the ISPC kernels are in a separate .o file. futhark-pycffi will have to be modified to also include that in the .so that gets built. (I don't actually remember who builds the .so.)
when doing ISPC classically (i.e. hand written / without Futhark), I used ISPC to build the .o, c++ to build tasksys.cpp (does Futhark use this or it's still single core only?), and then c++ -shared to build the .so.
Futhark's ISPC backend uses its own scheduler, not tasksys.cpp.
Probably a clause needs to be added here to link the correct stuff
https://github.com/pepijndevos/futhark-pycffi/blob/bb2ca15ca6473e2a3dbe4c8d915781f7d4913077/futhark_ffi/build.py#L32-L40