GithubHelp home page GithubHelp logo

xmp's Introduction

XMP

CUDA accelerated(X) Multi-Precision library

Please see documentation folder for more details

xmp's People

Contributors

dumerrill avatar luitjens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xmp's Issues

Compile Error

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?

Compute 7_0 errors

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.

Newer CUDA?

Any chance this repo might be updated to a newer version of CUDA?

Feature request: add GMP API compatibility, gmpbench results

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..

error: ‘memcpy’ was not declared in this scope

I got the error shown below compiling the library on my system, which has the following
characteristics:

  • Ubuntu 16.04 LTS
  • Cuda compilations tools v7.5.17
  • gcc version 5.3.1

/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 ...

Calling functions from device

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?

Error in doc

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.