Skip to content

Choose between CPU and GPU

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #9370
    sfraniatte
    Participant

    Dear community,

    I would like to know id it is possible to have a config.mk file which allow to choose between the use of CPU or GPU to run a calculation.
    Also, I have a computer with a GPU (nvidia RTX 3080Ti) and many CPU cores (64) on Ubuntu 24.04. However, I do not succeed to install Openmpi properly. When I launch a calculation with the mpirun option, the progression is not faster than when the calculation run in sequential mode… However, I succeeded to install properly on an other computer (a Ubuntu 22.04 VM on Windows 11). So my problem is to have a cuda aware installation of Openmpi.

    Thanks in advance,
    Sylvain

    #9371
    Adrian
    Keymaster

    How many MPI processes are detected by OpenLB? (first few lines in the terminal log)

    Does the output repeat? (If so MPI is not enabled during compilation)

    Did you check the user guide section 9.2.1?

    #9372
    sfraniatte
    Participant

    Where can I find the terminal log ? Is it when I compile Openlb at he installation ?

    Yes, I did follow this section…

    Thank you for your answer !
    Sylvain

    #9373
    Adrian
    Keymaster

    I mean the output after you call e.g. mpirun -np $whatever ./case

    So the command in the user guide for querying whether your MPI installation is CUDA aware returns true?

    #9374
    sfraniatte
    Participant

    Ok, the first lines after this call are :
    [MpiManager] Sucessfully initialized, numThreads=32
    [ThreadPool] Sucessfully initialized, numThreads=1

    Yes, it returned true. However, I uninstalled CUDA then to have Openmpi which works properly. Because, it was not working. And it still does not work…

    My main goal is to have Openmpi to use CPU. But I have the feeling that it is not possible due to the presence of the GPU card.

    So, to sum up, I uninstalled CUDA and I install again Openmpi as explained in the user manual (sudo apt-get install openmpi-bin openmpi-doc libopenmpi-dev) but it still does not work properly.

    Sylavin

    #9375
    Adrian
    Keymaster

    Ok, so MPI is detected correctly.

    What do you mean by “it still does not work”?

    If you compiled with GPU support (i.e. GPU_CUDA is set in the PLATFORMS array of your config) then a simple mpirun -np $whatwever ./case will use the first GPU for all 32 processes which almost certainly is not what you want. You will need to specify the CUDA_VISIBLE_DEVICES properly to select one GPU per process (and you probably don’t have 32 GPUs in this system so you will need to reduce the number of processes accordingly, there is documentation on this e.g. in the GPU example configs).

    If you just want to disable GPU usage all you need to do is not enable it – i.e. just remove the GPU_CUDA entry from PLATFORMS and recompile.

    #9376
    sfraniatte
    Participant

    I mean that the calculation is not faster than in sequential mode. The calculation is faster on my other computer with 6 Threads…

    Yes, indeed, I would like to use the CPUs only for now and one GPU in the future when my code will be ready for that.

    Thank you for the details.

    Sylvain

    #9377
    Adrian
    Keymaster

    Faster for which case in which configuration? If you are indeed using a single GPU stretched over 32 processes for (probably) a small default case it would be surprising to even get the same performance as in single threaded CPU-only mode. There are many different ways to tweak performance, given more details I’d be happy to advise.

    #9378
    sfraniatte
    Participant

    Ok, I have two computers :
    _ an Ubuntu 22.04 VM on windows 11 with 6 CPU cores (Intel(R) Core(TM) i5-10400T CPU @ 2.00GHz)
    _ an Ubuntu 24.04 with 32 CPU cores (AMD Ryzen Threadripper PRO 5975WX 32-Cores) and with a GPU card

    My goal, today, is to launch a calculation on the computer which run on Ubuntu 24.04 on the CPU cores to run a biger simulation. However, when I test with the same case (my own case), the calculation is slower than when it is done whith the VM on windows.

    I am wondering if the problem comes from CPUs which does not have the same brand.

    Sylvain

    #9379
    sfraniatte
    Participant

    I am sorry because I understood my error… The number of cores used was to high which slow down the calculation. Stupid mistake !

    Thanks a lot for your time !

    Sylvain

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.