sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
871 stars 297 forks source link

Problem including SofaCUDA plugin - compilation errors #4579

Closed Emanuele-n closed 2 months ago

Emanuele-n commented 2 months ago

Hello, I'am having troubles compiling the SofaCUDA plugin -Ubuntu 22.04 -SOFA 22.12 -gcc 11 -nvcc version:

  nvcc: NVIDIA (R) Cuda compiler driver
  Copyright (c) 2005-2023 NVIDIA Corporation
  Built on Fri_Jan__6_16:45:21_PST_2023
  Cuda compilation tools, release 12.0, V12.0.140
  Build cuda_12.0.r12.0/compiler.32267302_0

I get this error: error: identifier "umul24" is undefined from: .../applications/plugins/SofaCUDA/sofa/gpu/cuda/CudaContactMapper.cu(88)

I tried to solve replacing this line: map[curTestEntry.newIndex + threadIdx.x] = umul24(curTestEntry.elem1,nbPointsPerElem) + c.p1; with this line: map[curTestEntry.newIndex + threadIdx.x] = curTestEntry.elem1*nbPointsPerElem + c.p1;

but I get even more errors now, so I thought the plugin was written for a specific cuda version. Is that correct? Should I change my cuda toolkit version together with the gcc version?

alxbilger commented 2 months ago

It's probably due to the version of CUDA. You can try to downgrade to cuda 11. But you can also upgrade SOFA (v23.12), as it is now compatible with CUDA 12.

Emanuele-n commented 2 months ago

Thank you, it's working now