Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import existed data #4

Open
TerenceLiu98 opened this issue Apr 11, 2020 · 4 comments
Open

How to import existed data #4

TerenceLiu98 opened this issue Apr 11, 2020 · 4 comments

Comments

@TerenceLiu98
Copy link

Hi! I am using CUDA to accelerate the computing. However, by using CGBN, how could I import existed data generated by previous code, like I have already generated a 1024-bits number by using GMP Lib as mpz_t.
Also, if there is a sequence ${m_i}$, how can I do the opertion like $m_i + m_{i+1}$

Looking forward to your reply!

@nemmart
Copy link

nemmart commented Apr 11, 2020

Hi Terence -- you'd do it in a couple of steps. 1) mpz_export to export the mpz_t to cpu memory (take a look at from_mpz(...) in samples/utility/cpu_support.h). 2) copy the cpu memory to the GPU using cudaMalloc and cudaMemcpy(...) 3) launch your GPU kernel and use cgbn_load(...) to load up the data.

In terms of computing a sequence, you'd have to give me some more detail about what exactly you're trying to compute. But samples/sample_03_powm essentially computes a sequence.

Good luck,
Niall

@TerenceLiu98
Copy link
Author

Thanks a lot! I have already figure out how to solve the second problem: I could just shift the position and let it become two sequence and do the addition inside the GPU. And, I would try mpz_export as you mentioned. 😃

@TerenceLiu98
Copy link
Author

TerenceLiu98 commented Apr 11, 2020

@nemmart Actually, one more question, it is about the xmp library: When I import Integer by using xmpIntegersImport I found that the char * I would like to import's size is 16, but the output's size is only 4, How can I fix it ?
The error is xmpErrorPrecision

@TerenceLiu98 TerenceLiu98 reopened this Apr 11, 2020
@TerenceLiu98
Copy link
Author

Hi Terence -- you'd do it in a couple of steps. 1) mpz_export to export the mpz_t to cpu memory (take a look at from_mpz(...) in samples/utility/cpu_support.h). 2) copy the cpu memory to the GPU using cudaMalloc and cudaMemcpy(...) 3) launch your GPU kernel and use cgbn_load(...) to load up the data.

In terms of computing a sequence, you'd have to give me some more detail about what exactly you're trying to compute. But samples/sample_03_powm essentially computes a sequence.

Good luck,
Niall

In CGBN, it has a concept called instance, the number I would like to import should inside the instance or I could just leave it outside fo the instance?

Looking forward to your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants