kaolin icon indicating copy to clipboard operation
kaolin copied to clipboard

Potentially unnecessary CUDA dependency

Open a-gardner1 opened this issue 4 months ago • 4 comments

In point_to_mesh_distance, a call to torch.cuda.synchronize causes a fatal crash on systems without NVIDIA GPUs installed.

This synchronize call seems redundant since the _unbatched_naive_point_to_mesh_distance only gets called if the inputs are not on a CUDA device.

We encountered this when trying to use the CPU wheel at https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.8.0_cpu.html in a CI pipeline on a machine without a GPU.

a-gardner1 avatar Jul 20 '26 20:07 a-gardner1

Hi @a-gardner1 , good catch! I can't recall why this torch.cuda.synchronize() is here, but I'll try to run CI after removing it.

Thanks!

Caenorst avatar Jul 20 '26 21:07 Caenorst

I will take this issue. Please assign it to me.

The torch.cuda.synchronize call in point_to_mesh_distance appears unnecessary. It is reached even when inputs are not on a CUDA device, which causes a crash on non-GPU systems. I would first inspect the logic around line 91 to confirm the conditions under which the function is called. Then, I would remove or guard the synchronize call to ensure it only executes when a CUDA device is present. I will test the change on both CPU and GPU setups to verify the fix.

modelpath-dev avatar Sep 10 '26 21:09 modelpath-dev

I am looking into this now. I will check the logic and test the changes on both CPU and GPU setups. Let me know if there are any specific tests you want me to run.

modelpath-dev avatar Sep 13 '26 08:09 modelpath-dev

Stale issue, please reopen if still relevant

github-actions[bot] avatar Nov 12 '26 21:11 github-actions[bot]