- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to offload a portion of code in a C mex file? I'm getting an error
offload error: cannot load library to the device 0 (error code 5)
and before continuing it would be nice to know if this is at all possible.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know of anyone who has tried this. I do know that, by default, MATLAB uses the the Intel mkl library for BLAS and LAPACK routines when run on Intel processors and that there is an automatic offload option that can be used to allow the mkl library itself offload some of the work to the coprocessor. You can see the directions for enabling automatic offload here - https://software.intel.com/en-us/articles/using-intel-math-kernel-library-with-mathworks-matlab-on-intel-xeon-phi-coprocessor-system.
If you want to try your own offload code again, what I would suggest is - before you start MATLAB, set up your compiler environment using the scripts Intel provides for this. On Linux, it would be 'source /<compiler_installation_directory>/bin/compilervars.sh intel64'; on Windows, it would be '<compiler_installation_directory>\bin\compilervars.bat intel64'.
If this doesn't work, try creating a library with the offload code compiled outside of MATLAB. You will need to make sure your environment is properly set as above and use 'xiar –qoffload-build ar options archive member ...]' to build the library, then create one or more gateway routines that can be compiled with mex and used to call routines in the library.
If you discover anything interesting while you are working on this, let me know.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page