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

CGBN context creation and Too few arguments in function call #29

Open
hiddenvs opened this issue Sep 25, 2024 · 1 comment
Open

CGBN context creation and Too few arguments in function call #29

hiddenvs opened this issue Sep 25, 2024 · 1 comment

Comments

@hiddenvs
Copy link

Part of source code:

 20 // Define the kernel
 21 __global__ void solve_kernel(problem_instance_t *problem_instances, uint32_t instance_count) {
 22     // Create a CGBN context
 23     cgbn_error_report_t *report = cgbn_error_report_alloc();
 24     cgbn_context_t<TPI> bn_context(cgbn_error_report_alloc(), report);
 25     // Construct a bn environment for 256-bit math
 26     typedef cgbn_env_t<cgbn_context_t<TPI>, 256> env256_t;
 27     env256_t bn256_env(bn_context);
 28     // Define 256-bit values
 29     env256_t::cgbn_t c, p, temp, Z_val, N_val;
 30
 31     int32_t my_instance = (blockIdx.x * blockDim.x + threadIdx.x) / TPI;  // Determine instance number
 32     if (my_instance >= instance_count) return;  // Return if instance is not valid

Compiling error:

test3.cu(23): error: too few arguments in function call
test3.cu(24): error: too few arguments in function call

What I found in examples and source codes for CGBN:
cudaError_t cgbn_error_report_alloc(cgbn_error_report_t **report);

What am I missing ?

@hiddenvs hiddenvs changed the title CGBN context creatopm and Too few arguments in function call CGBN context creation and Too few arguments in function call Sep 25, 2024
@luitjens
Copy link
Contributor

As a heads up this project is unstaffed and support for it is extremely limited. With that said it looks like this error message is because you are not using cgbn_error_report_alloc() correctly. Have you looked at the examples? It also looks like you might be using host functions on the device. You will notice in the example pasted below this function is called from the host and takes an object by reference which gets allocated. You then pass this to the device via a kernel argument.

https://github.com/NVlabs/CGBN/blob/master/samples/sample_01_add/add.cu#L132

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