When I try to compile the following code with c++
on OS X 10.8, it works fine - no compile errors.
#include <gmpxx.h>
int main(int argc, const char * argv[]) { }
However, when I try to do the same with nvcc
, I get a ton of errors:
/usr/local/Cellar/gcc47/4.7.3/gcc/lib/gcc/x86_64-apple-darwin12.5.0/4.7.3/../../../../include/c++/4.7.3/limits(1405): error: identifier "__int128" is undefined
/usr/local/Cellar/gcc47/4.7.3/gcc/lib/gcc/x86_64-apple-darwin12.5.0/4.7.3/../../../../include/c++/4.7.3/limits(1421): error: function call is not allowed in a constant expression
...
How can I use GMP with NVCC/CUDA? To clarify, I don't intend to perform GMP calculations on the device, just the host.
Create a .cpp
module that you compile with your host compiler, and
include your GMP code there.
Create a separate .cu
module that you compile with nvcc
, and include
your CUDA code there.
Link them together.