CUDA accelerated(X) Multi-Precision library
Please see documentation folder for more details
CUDA accelerated(X) Multi-Precision library
License: Other
Hello, I am now using the xmp lib for my project. When I download the example code. (simple_rsa.cc) I could not compile the code perfectly, no metter using gcc
, g++
or nvcc
. Here is my command:
g++ simple_rsa.cc -L lib/libxmp.so lib/libxmp.a
And I got this errors:
simple_rsa.cc: In function ‘int main()’:
simple_rsa.cc:117:81: error: invalid conversion from ‘uint32_t* {aka unsigned int*}’ to ‘uint32_t {aka unsigned int}’ [-fpermissive]
XMP_CHECK_ERROR(xmpIntegersImport(handle,n,limbs,-1,sizeof(uint32_t),0,0,h_n,1));
^
simple_rsa.cc:29:20: note: in definition of macro ‘XMP_CHECK_ERROR’
xmpError_t error=fun; \
^~~
In file included from simple_rsa.cc:1:0:
/home/pi/Documents/xmp/include/xmp.h:127:19: note: initializing argument 8 of ‘xmpError_t xmpIntegersImport(xmpHandle_t, xmpIntegers_t, uint32_t, uint32_t, int32_t, size_t, int32_t, uint32_t, void*)’
xmpError_t XMPAPI xmpIntegersImport(xmpHandle_t handle, xmpIntegers_t out, uint32_t count, uint32_t words, int32_t order, size_t size, int32_t endian, uint32_t nails, void* in);
^~~~~~~~~~~~~~~~~
simple_rsa.cc:117:81: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]
XMP_CHECK_ERROR(xmpIntegersImport(handle,n,limbs,-1,sizeof(uint32_t),0,0,h_n,1));
^
simple_rsa.cc:29:20: note: in definition of macro ‘XMP_CHECK_ERROR’
xmpError_t error=fun; \
^~~
In file included from simple_rsa.cc:1:0:
/home/pi/Documents/xmp/include/xmp.h:127:19: note: initializing argument 9 of ‘xmpError_t xmpIntegersImport(xmpHandle_t, xmpIntegers_t, uint32_t, uint32_t, int32_t, size_t, int32_t, uint32_t, void*)’
xmpError_t XMPAPI xmpIntegersImport(xmpHandle_t handle, xmpIntegers_t out, uint32_t count, uint32_t words, int32_t order, size_t size, int32_t endian, uint32_t nails, void* in);
^~~~~~~~~~~~~~~~~
simple_rsa.cc:118:77: error: invalid conversion from ‘uint32_t* {aka unsigned int*}’ to ‘uint32_t {aka unsigned int}’ [-fpermissive]
XMP_CHECK_ERROR(xmpIntegersImport(handle,e,1,-1,sizeof(uint32_t),0,0,h_e,1));
^
simple_rsa.cc:29:20: note: in definition of macro ‘XMP_CHECK_ERROR’
xmpError_t error=fun; \
^~~
In file included from simple_rsa.cc:1:0:
/home/pi/Documents/xmp/include/xmp.h:127:19: note: initializing argument 8 of ‘xmpError_t xmpIntegersImport(xmpHandle_t, xmpIntegers_t, uint32_t, uint32_t, int32_t, size_t, int32_t, uint32_t, void*)’
xmpError_t XMPAPI xmpIntegersImport(xmpHandle_t handle, xmpIntegers_t out, uint32_t count, uint32_t words, int32_t order, size_t size, int32_t endian, uint32_t nails, void* in);
^~~~~~~~~~~~~~~~~
simple_rsa.cc:118:77: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]
XMP_CHECK_ERROR(xmpIntegersImport(handle,e,1,-1,sizeof(uint32_t),0,0,h_e,1));
^
simple_rsa.cc:29:20: note: in definition of macro ‘XMP_CHECK_ERROR’
xmpError_t error=fun; \
^~~
In file included from simple_rsa.cc:1:0:
/home/pi/Documents/xmp/include/xmp.h:127:19: note: initializing argument 9 of ‘xmpError_t xmpIntegersImport(xmpHandle_t, xmpIntegers_t, uint32_t, uint32_t, int32_t, size_t, int32_t, uint32_t, void*)’
xmpError_t XMPAPI xmpIntegersImport(xmpHandle_t handle, xmpIntegers_t out, uint32_t count, uint32_t words, int32_t order, size_t size, int32_t endian, uint32_t nails, void* in);
^~~~~~~~~~~~~~~~~
simple_rsa.cc:119:81: error: invalid conversion from ‘uint32_t* {aka unsigned int*}’ to ‘uint32_t {aka unsigned int}’ [-fpermissive]
XMP_CHECK_ERROR(xmpIntegersImport(handle,d,limbs,-1,sizeof(uint32_t),0,0,h_d,1));
^
simple_rsa.cc:29:20: note: in definition of macro ‘XMP_CHECK_ERROR’
xmpError_t error=fun; \
^~~
In file included from simple_rsa.cc:1:0:
/home/pi/Documents/xmp/include/xmp.h:127:19: note: initializing argument 8 of ‘xmpError_t xmpIntegersImport(xmpHandle_t, xmpIntegers_t, uint32_t, uint32_t, int32_t, size_t, int32_t, uint32_t, void*)’
xmpError_t XMPAPI xmpIntegersImport(xmpHandle_t handle, xmpIntegers_t out, uint32_t count, uint32_t words, int32_t order, size_t size, int32_t endian, uint32_t nails, void* in);
^~~~~~~~~~~~~~~~~
simple_rsa.cc:119:81: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]
XMP_CHECK_ERROR(xmpIntegersImport(handle,d,limbs,-1,sizeof(uint32_t),0,0,h_d,1));
^
simple_rsa.cc:29:20: note: in definition of macro ‘XMP_CHECK_ERROR’
xmpError_t error=fun; \
^~~
In file included from simple_rsa.cc:1:0:
/home/pi/Documents/xmp/include/xmp.h:127:19: note: initializing argument 9 of ‘xmpError_t xmpIntegersImport(xmpHandle_t, xmpIntegers_t, uint32_t, uint32_t, int32_t, size_t, int32_t, uint32_t, void*)’
xmpError_t XMPAPI xmpIntegersImport(xmpHandle_t handle, xmpIntegers_t out, uint32_t count, uint32_t words, int32_t order, size_t size, int32_t endian, uint32_t nails, void* in);
^~~~~~~~~~~~~~~~~
simple_rsa.cc:120:85: error: invalid conversion from ‘uint32_t* {aka unsigned int*}’ to ‘uint32_t {aka unsigned int}’ [-fpermissive]
MP_CHECK_ERROR(xmpIntegersImport(handle,m,limbs,-1,sizeof(uint32_t),0,0,h_m,count));
^
simple_rsa.cc:29:20: note: in definition of macro ‘XMP_CHECK_ERROR’
xmpError_t error=fun; \
^~~
In file included from simple_rsa.cc:1:0:
/home/pi/Documents/xmp/include/xmp.h:127:19: note: initializing argument 8 of ‘xmpError_t xmpIntegersImport(xmpHandle_t, xmpIntegers_t, uint32_t, uint32_t, int32_t, size_t, int32_t, uint32_t, void*)’
xmpError_t XMPAPI xmpIntegersImport(xmpHandle_t handle, xmpIntegers_t out, uint32_t count, uint32_t words, int32_t order, size_t size, int32_t endian, uint32_t nails, void* in);
^~~~~~~~~~~~~~~~~
simple_rsa.cc:120:85: error: invalid conversion from ‘int’ to ‘void*’ [-fpermissive]
MP_CHECK_ERROR(xmpIntegersImport(handle,m,limbs,-1,sizeof(uint32_t),0,0,h_m,count));
^
simple_rsa.cc:29:20: note: in definition of macro ‘XMP_CHECK_ERROR’
xmpError_t error=fun; \
^~~
In file included from simple_rsa.cc:1:0:
/home/pi/Documents/xmp/include/xmp.h:127:19: note: initializing argument 9 of ‘xmpError_t xmpIntegersImport(xmpHandle_t, xmpIntegers_t, uint32_t, uint32_t, int32_t, size_t, int32_t, uint32_t, void*)’
xmpError_t XMPAPI xmpIntegersImport(xmpHandle_t handle, xmpIntegers_t out, uint32_t count, uint32_t words, int32_t order, size_t size, int32_t endian, uint32_t nails, void* in);
^~~~~~~~~~~~~~~~~
Is there any method to fix this problem?
I'm getting the following errors when attempting to compile with CUDA 10.1 V10.1.243:
ptxas /tmp/tmpxft_00004b30_00000000-5_distributedmp.compute_70.ptx, line 41537; error : Instruction 'shfl' without '.sync' is not supported on .target sm_70 and higher from PTX ISA version 6.4
I've fixed the errors by using shfl.sync i.e.
#if __CUDA_ARCH__ >= 700
asm volatile ("shfl.sync.up.b32 %0|%%c1, %1, 1, %2, 0xffffffff;" : "=r"(x) :\
"r"(r1), "r"((256-_width)*256));
#else
asm volatile ("shfl.up.b32 %0|%%c1, %1, 1, %2;" : "=r"(x) : "r"(r1), "r"((25\
6-_width)*256));
#endif
and
#if CUDA_ARCH >= 700
asm volatile ("setp.eq.and.u32 %%c2,%1,0xFFFFFFFF,%%c1;\n\t"
"vote.sync.ballot.b32 %0,%%c2, 0xFFFFFFFF;"
: "=r"(p) : "r"(x));
asm volatile ("setp.eq.u32 %%c2,%1,1;\n\t"
"vote.sync.ballot.b32 %0,%%c2, 0xFFFFFFFF;"
: "=r"(g) : "r"(r1));
#else
asm volatile ("setp.eq.and.u32 %%c2,%1,0xFFFFFFFF,%%c1;\n\t"
"vote.ballot.b32 %0,%%c2;" : "=r"(p) : "r"(x));
asm volatile ("setp.eq.u32 %%c2,%1,1;\n\t"
"vote.ballot.b32 %0,%%c2;" : "=r"(g) : "r"(r1));
#endif
Wherever needed, however, it was a mechanical Turk kind of thing because I never programmed in CUDA and certainly not low level CUDA, so I'm not sure if the implementation is correct.
Any chance this repo might be updated to a newer version of CUDA?
Hi,
Just seen project on github but no source code still..
Would be nice if similar to how cublas, cufft provide standard API with popular CPU libraries like FFTW this cuda multiprecision library has API like GMP so codes using GMP doesn't need to be ported.. Assuming no performance is lost using this API..
I got the error shown below compiling the library on my system, which has the following
characteristics:
/usr/include/string.h: In function ‘void* mempcpy_inline(void, const void, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
return (char ) memcpy (__dest, __src, __n) + __n;
^
Makefile:20: recipe for target 'xmp.o' failed
make: ** [xmp.o] Error 1
I actually fixed it by adding the _FORCE_INLINES definition on nvcc compiler flags
NVCC_FLAGS=-D_FORCE_INLINES ...
Is it safe to call functions like regmp_add_kernel from a device kernel function by including implementation.h? Or should functions only be called from CPU side? Any possibility of adding a device API in the future?
there is copy-paste error in example in https://github.com/NVlabs/xmp/blob/master/docs/xmp.docx
XMP_CHECK_ERROR(xmpIntegersImport(handle,base,N,limbs,-1,sizeof(uint32_t),0,0,b));
XMP_CHECK_ERROR(xmpIntegersImport(handle,exp,1,limbs,-1,sizeof(uint32_t),0,0,b));
XMP_CHECK_ERROR(xmpIntegersImport(handle,mod,1,limbs,-1,sizeof(uint32_t),0,0,b));
last parameter here should be b/e/m rather than b/b/b
When running crt_rsa.exe on AWS P3.2XLarge and P2.XLarge with CUDA 10 the test gets stuck. If the number of iterations is decreased the test completes.
Thanks,
Yuval.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.