Could I get some insight on how to convert this kernel code from C++ to Pycuda?
cudaExtent volumeSize = make_cudaExtent(128, 128, 128); //sweep construction convert distance to material if needed (sweepfun == 1) void convert_dis2material(cudaExtent volumeSize,int originaldim,int sweepfun) { // Specify texture struct cudaResourceDesc resDescsurface; memset(&resDescsurface, 0, sizeof(resDescsurface)); resDescsurface.resType = cudaResourceTypeArray; resDescsurface.res.array.array = d_volumeArray1; //blue // Specify texture object parameters struct cudaTextureDesc texDescsurface; memset(&texDescsurface, 0, sizeof(texDescsurface)); texDescsurface.addressMode[0] = cudaAddressModeClamp; texDescsurface.addressMode[1] = cudaAddressModeClamp; texDescsurface.addressMode[2] = cudaAddressModeClamp; texDescsurface.filterMode = cudaFilterModePoint; texDescsurface.readMode = cudaReadModeElementType; texDescsurface.normalizedCoords = 0; cudaTextureObject_t texObj1; cudaCreateTextureObject(&texObj1, &resDescsurface, &texDescsurface, NULL); surfaceintegral(texObj1,originaldim,volumeSize); //finishing integration on blue cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<VolumeType>(); dim3 dimBlock1 (8,8,8); dim3 dimGrid1 ((volumeSize.width+dimBlock1.x-1)/dimBlock1.x,(volumeSize.height+dimBlock1.y-1)/dimBlock1.y,(volumeSize.depth+dimBlock1.z-1)/dimBlock1.z); float *d_volume; checkCudaErrors(cudaMalloc((void**)&d_volume, volumeSize.depth*volumeSize.depth*volumeSize.depth*sizeof(float))); dis2material_kernel<<<dimGrid1,dimBlock1>>>(d_volume,texObj1,sweepfun,volumeSize,originaldim,maxnegdis,objcoorminx,objcoormaxx,objcoorminy,objcoormaxy,objcoorminz,objcoormaxz); cudaDeviceSynchronize(); // create 3D array cudaFreeArray(d_volumeArray1); checkCudaErrors(cudaMalloc3DArray(&d_volumeArray1, &channelDesc, volumeSize)); // copy data to 3D array cudaMemcpy3DParms copyParams = {0}; copyParams.srcPtr = make_cudaPitchedPtr(d_volume, volumeSize.width*sizeof(VolumeType), volumeSize.width, volumeSize.height); copyParams.dstArray = d_volumeArray1; copyParams.extent = volumeSize; copyParams.kind = cudaMemcpyDeviceToDevice; checkCudaErrors(cudaMemcpy3D(©Params)); cudaFree(d_volume); cudaDestroyTextureObject(texObj1); //destroy texobj before update the new d_volumeArray to it. } -- View this message in context: http://pycuda.2962900.n2.nabble.com/C-to-Python-code-conversion-help-tp7575721.html Sent from the PyCuda mailing list archive at Nabble.com. _______________________________________________ PyCUDA mailing list PyCUDA@tiker.net https://lists.tiker.net/listinfo/pycuda