Skip to content

How do I put multiple parameters as arguments to the kernel function. #8

Description

@uniquerussa

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions