PROTEUS-SIM / PROTEUS

MIT License
11 stars 0 forks source link

GPU cannot be used in Ubuntu and MATLAB 2019b #2

Open renxwang opened 2 months ago

renxwang commented 2 months ago

I got a problem when I would like to simulate using GPU in Ubuntu and MATLAB 2019b. image

It works if I only use CPU so it is not because of the problem of k-wave 1.3. I think this problem is due to the MATLAB version and the h5read function. The simulator can also work with GPU on Windows10 and MATLAB 2021a. I tried to copy h5read function from MATLAB 2021a but it still have the above problem.

Should I have to upgrade my MATLAB version?

GLajoinie commented 2 months ago

Dear Renxwang, As a preliminary check, I see you are trying to use the third GPU (CUDA ID=2). Are there indeed 3 available GPUs in your machine? It appear the code cannot acces it.

renxwang commented 2 months ago

Dear Renxwang, As a preliminary check, I see you are trying to use the third GPU (CUDA ID=2). Are there indeed 3 available GPUs in your machine? It appear the code cannot acces it.

Yes, there are 3 GPUs. All the GPUs have the same problems by running in the command line. image

If I run by GUI, same error will happen. image

I think I have to reinstall matlab with a newer version.

NathanBlanken commented 2 months ago

Can you check if you can access the GPUs directly from the MATLAB command line by entering gpuDevice(IDX)?

D = gpuDevice(IDX) selects the GPU device by index IDX. IDX must be between
    1 and GPUDEVICECOUNT. An error may occur if the GPU device is not supported
    for use. Note that selecting a device, even if it is already selected,
    resets that device and invalidates any existing gpuArrays and CUDAKernels.

Note that MATLAB counts the GPUs starting from 1, unlike PROTEUS, k-Wave, or Linux systems, which start counting from 0.

I don't think the MATLAB version is necessarily an issue. We have used the same MATLAB version (2019b) for a major part of the development of PROTEUS and we have never encountered this issue.