4
$\begingroup$

I installed Mathematica 13.2 under Linux Mint 21.1 (Ubuntu 22.04). After installing cuda-toolkit-11-8. I get True as answer from CUDAQ[], but if I start some calculations I get wrong results.

Following the Documentation examples I can produce errors in CUDAMap, CUDADot and many other CUDA functions. There are no error messages at all just wrong results.

Example: enter image description here

With older Mathematica Versions CUDA was running fine.

Has anybody experienced the same behavior? Can someone give a hint how to fix this?

Update: I tried to follow the solution BertRAMAerts provided. I created the following script and started Mathematica with it. Unfortunately there was no change in the results enter image description here

What really puzzles me, is that there is no error message at all. Simply wrong results which is very dangerous to my point of view. If someone is using this functions in a more sophisticated code he can run into serious problems without knowing the root cause.

$\endgroup$
6
  • $\begingroup$ On Windows with a 1080ti on Mathematica 13.2, the difference between CUDA and CPU results is {0., 0., 0., 0., 5.55112*10^-17, 1.11022*10^-16, 0., 0., 0., 0.} so they pretty much agree. Maybe it's something wrong in Linux only? Do you see a similar result with OpenCL? - try running this pastebin.com/WFiNF4eH $\endgroup$
    – flinty
    Commented Dec 23, 2022 at 18:20
  • $\begingroup$ Thank you your suggestion I will try it tomorow ... $\endgroup$
    – Tschibi
    Commented Dec 23, 2022 at 20:33
  • $\begingroup$ I tried the code you provided but OpenCL fails already at OpenCLQ[]. I get OpenCLFunctionLoad::invplt: OpenCLLink platform is invalid. when I run the function. I tried different CUDA Versions 11.7, 11.8 and 12. All causing different errors. CUDA 11.2 is not available for my Ubuntu 22.04. Does somebody know a workaround? $\endgroup$
    – Tschibi
    Commented Dec 29, 2022 at 10:58
  • $\begingroup$ Can I use CUDA functionality in Mathematica with CUDA Version 11.7 or 11.8? Or do I have to find a way to make 11.2 run on Ubuntu 22.04? $\endgroup$
    – Tschibi
    Commented Dec 29, 2022 at 11:12
  • $\begingroup$ I checked the cuda functionality again with Mathematica 13.2 and 13.2.1. While on Windows It runs fine with cuda toolkit 11.8 I still get the same error under Ubuntu. The OpenCLLink package does not load with the follwoing error message: "One or more OpenCL resource failed to load." $\endgroup$
    – Tschibi
    Commented Feb 11, 2023 at 9:02

2 Answers 2

1
$\begingroup$

On my Ubuntu 22.10 laptop with nVIDIA GeForce RTX 2060 I get correct results:

enter image description here

Please note I start Mathematica from terminal with:

cat mathematica.sh

export NVIDIA_DRIVER_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libnvidia-tls.so.525.89.02
export CUDA_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libcuda.so
export PATH=/home/bert/bin_gcc_11:/usr/local/cuda-11.8/bin:$PATH$
g++ --version
mathematica &

Please always verify if CUDA is OK via:

enter image description here

$\endgroup$
4
  • $\begingroup$ Thank you very much for you help. Please find my the update to my original post, where I tried your approach. $\endgroup$
    – Tschibi
    Commented Mar 17, 2023 at 9:37
  • $\begingroup$ @Tschibi Please check my updated answer $\endgroup$ Commented Mar 17, 2023 at 9:47
  • $\begingroup$ CUDA Toolkit 12.2 released today. Mathematica 13.3.0 released today. CUDA via Mathematica is a real disaster. CUDAMap, CUDADot give invalid results. When specifying a kernel function in code, results seem correct though. $\endgroup$ Commented Jun 28, 2023 at 19:57
  • $\begingroup$ More details on community.wolfram.com/groups/-/m/t/2946813?p_p_auth=7MWngAvx $\endgroup$ Commented Jun 28, 2023 at 20:19
1
$\begingroup$

The problem was solved with Mathematica 13.3.1. Thank you all for you help and input.

I run the configuration below on Linux Mint 21.2 and can see no problems/errors so far

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.