OpenCL error -37 (CL_INVALID_HOST_PTR)
GottfriedHofmann opened this issue · 9 comments
Hello Ryan,
I compiled successfully, but when I run I get the following error:
Frame: 0
StepTime: 0.0333
Update Fluid Cells: 0
Num Fluid Cells: 95767
Num Marker Particles: 735903
Reconstruct Fluid Surface: 0
Update Level set: 0
Reconstruct Output Surface: 0
ERROR: Creating position data buffer (-37)
fluidsim: src/clscalarfield.cpp:423: void CLScalarField::_checkError(cl_int, const char*): Assertion `err == 0' failed.
Aborted (core dumped)
I compiled on Ubuntu 15.10 with nvidia opencl 352
Unfortunately that is all the info I can give.
Hello Gottfried,
Thank you for letting me know about this issue. Would it be possible for you to rerun the program on the "debug_clscalarfield" branch and copy the output? I'm hoping that the output will help me understand what is causing this error.
https://github.com/rlguy/GridFluidSim3D/tree/debug_clscalarfield
Greatest Regards,
Ryan
I ended up running into the same error during a simulation and was able to debug and resolve the error. The master branch has been updated with the correction in this commit.
Hopefully this fixes the error you were running into.
Thank you for your efforts, will test once I'm back at my workstation!
Hello, I fetched the debug_clscalarfield branch. Running fluidsim now yields the following output:
Initializing OpenCL Device:
Num platforms: 1
Found first preference CL device.
fluidsim: src/fluidsimulation.cpp:1017: void FluidSimulation::_initializeCLObjects(): Assertion `_scalarFieldAccelerator.initialize()' failed.
Aborted (core dumped)
hmm, the output above was on a fresh build. after doing a make clean and make again, here is the new output:
./fluidsim
Initializing OpenCL Device:
Num platforms: 1
Found first preference CL device.
30-Apr-2016 16h10m18s
Frame: 0
StepTime: 0.0333
Update Fluid Cells: 0
Num Fluid Cells: 95767
Num Marker Particles: 735903
Reconstruct Fluid Surface: 0
Update Level set: 0
Reconstruct Output Surface: 0
Computing velocity scalar field for direction: 0
Using CL device:
CL_DEVICE_NAME: GeForce GTX 580
CL_DEVICE_VENDOR: NVIDIA Corporation
CL_DEVICE_VERSION: OpenCL 1.1 CUDA
CL_DRIVER_VERSION: 352.63
CL_DEVICE_OPENCL_C_VERSION: OpenCL C 1.1
CL_DEVICE_TYPE: GPU
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1544MHz
CL_DEVICE_GLOBAL_MEM_SIZE: 3220897792
CL_DEVICE_LOCAL_MEM_SIZE: 49152
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 805224448
CL_DEVICE_MAX_WORK_GROUP_SIZE: 1617210112
CL_DEVICE_MAX_WORK_ITEM_SIZES: 1024 x 0 x 1024
Adding 735903 point values to scalar field:
Grid Dimensions: 65 x 64 x 64
Scalar field Dimensions: 65 x 64 x 64
Weight field Dimensions: 65 x 64 x 64
Cell size: 0.125
Particle Radius: 0.125
Field offset: 0 0.0625 0.0625
_initializePointValues():
Num Points: 735903
Num Values: 735903
Num PointValues: 735903
_getWorkGroupGridDimensions():
_chunkWidth: 6
_chunkHeight: 6
_chunkDepth: 6
WorkGroup grid dimensions: 11 x 11 x 11
_insertParticlesIntoWorkGroupGrid():
Num particles: 735903
Inserted 1742785 particles into grid.
Counting particles in grid:
Num particles: 1742785
_initializeWorkChunks():
Num WorkChunks: 2260
Num particles in work chunks: 1742785
_getMaxChunksPerWeightPointValueComputation():
pointDataSize: 16000
fieldDataSize: 1728
offsetDataSize: 12
numPositionAllocItems: 50326
numFieldAllocItems: 465986
numOffsetAllocItems: 67102037
allocLimitCount: 50326
totalDataSize: 17740
globalMemLimitCount: -60546
hardwareLimit: -60546
softwareLimit: 5000
Max chunks: -60546
Computing 0 WorkChunks:
_computePointValueScalarWeightField():
Num WorkChunks: 0
Max particles in work chunk: 0
Initialize DataBuffer:
Num Particles: 0
Num WorkChunks: 0
_getHostPointValueDataBuffer():
numParticles: 0
numElements: 0
Num WorkChunks: 0
Buffer size: 0
_getHostScalarFieldDataBuffer():
buffer size: 0
_getHostChunkOffsetDataBuffer():
buffer _getHostChunkOffsetDataBuffer: 0
_initializeCLDataBuffers():
buffer.pointDataH.size(): 0
buffer.scalarFieldDataH.size(): 0
buffer.offsetDataH.size(): 0
pointDataBytes: 0
scalarFieldDataBytes: 0
offsetDataBytes: 0
ERROR: Creating position data buffer (-37)
fluidsim: src/clscalarfield.cpp:479: void CLScalarField::_checkError(cl_int, const char*): Assertion `err == 0' failed.
Aborted (core dumped)
Hello Gottfried,
Thanks for the output! It looks like the error you were encountering was caused by an integer overflow error. The error has been corrected in the master and debug_clscalarfield branch.
I hope that this fixes the error you were receiving!
Best Regards,
Ryan
thank you so much, works like a charm now!
Hi Gottrfried,
this is a bit offtopic, but I hope you might share the one or other hint.
I stumbled across this thread by accident; having troubles with a program running into openCL error - 37.
Further I do understand this is no related to your app at all. I'm just curious if you might have an idea on how fixing such an error.
Due to another error upfront I had to install Mesa3D drivers to fix another issue.
The idea, could Mesa3D be used to fix the openCL 37 error(?) without having access to the source of the initial "app" causing the error.
Any thoughts are very welcome - thank you.
Hello! The errors in this issue were triggered by the program attempting to reserve invalid amounts of memory such as reserving 0 bytes or a negative number of bytes. The cause of these bugs were due to logic errors during implementation.
What could cause this error code in your application could be specific to the program, so I'm I'm sorry to say that I'm not sure of any solutions.
I'm not sure if there is a fix for this in your situation on the user-side of your application. This is something that may need to be fixed in the application source code by the developers.