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 do I put multiple parameters as arguments to the kernel function. #8

Open
uniquerussa opened this issue Nov 14, 2014 · 2 comments

Comments

@uniquerussa
Copy link

test.cu

__global__ void helloWorld(char *data) {

change
test.cu

__global__ void helloWorld(char *data, char *data2) {

cuda.js

module.exports.launch = function () {
  var func = arguments[0];
  var gridDim = arguments[1];
  var blockDim = arguments[2];
  var args = arguments[3];
  var args2= arguments[4];

  args = module.exports.prepareArguments(args);
  args2 = module.exports.prepareArguments(args2);

  return func.launchKernel(gridDim, blockDim, args, args2 );
}

function.cpp

Local<Object> buf = args[2]->ToObject();
  char *pbuffer = Buffer::Data(buf);
  size_t bufferSize = Buffer::Length(buf);

Local<Object> buf 2= args[3]->ToObject();
  char *pbuffer2 = Buffer::Data(buf2);
  size_t bufferSize2 = Buffer::Length(buf2);


void *cuKernel_Parameters= { &pbuffer , & pbuffer2}
 /*
 void *cuExtra[] = {
    CU_LAUNCH_PARAM_BUFFER_POINTER, pbuffer,
    CU_LAUNCH_PARAM_BUFFER_SIZE,    &bufferSize,
    CU_LAUNCH_PARAM_END
  };*/

  CUresult error = cuLaunchKernel(pfunction->m_function,
      gridDimX, gridDimY, gridDimZ,
      blockDimX, blockDimY, blockDimZ,
      0, 0, cuKernel_Parameters, NULL);

If i have access to an array data2 in kernel function, This code returns a 700 error.

@kashif
Copy link
Owner

kashif commented Nov 15, 2014

thanks for the issue @teriusbin I will have a look...

@uniquerussa
Copy link
Author

Multi- parameter problem is solved. Another question is how can I bind runtime api?

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