Giter Site home page Giter Site logo

GPU pinning about galario HOT 2 CLOSED

mtazzari avatar mtazzari commented on August 25, 2024
GPU pinning

from galario.

Comments (2)

fredRos avatar fredRos commented on August 25, 2024

We decided to do leave this to the user's control via

void galario_use_gpu(int device_id);

from galario.

mtazzari avatar mtazzari commented on August 25, 2024

The issue is still closed, but I 'd like to post this for reference.

I see a funny behaviour on my desktop regarding GPU pinning. The GPU ID at runtime appears different from that read in nvidia-smi. The reason boils down to the fact that:

nvidia-smi enumerates in PCI order while, by default, the CUDA driver and runtime APIs do not.

(from https://stackoverflow.com/questions/26123252/inconsistency-of-ids-between-nvidia-smi-l-and-cudevicegetname)

This is the output of nvidia-smi:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.66                 Driver Version: 375.66                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GT 730	   Off  | 0000:01:00.0     N/A |		  N/A |
| N/A   46C    P0    N/A /  N/A |     86MiB /  2000MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 1060   Off  | 0000:02:00.0     Off |		  N/A |
|  0%   55C    P0    25W / 140W |      1MiB /  6072MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

where it seems that gpu 1 is GTX 1060, i.e. the GPGPU-dedicated one, and gpu 0 is GT 730, i.e. the default system graphics card where I don't want to run the CUDA code.

The issue is that ngpus = g_double.ngpus() sets ngpus=2, which is correct, but g_double.use_gpu(max(0, ngpus-1))=use_gpu(max(0, 1))=use_gpu(1) makes the script use GT 730 instead of GTX 1060.

The reason of the discrepancy is stated above in quotes. nvidia-smi docs suggest:

"It is recommended that users desiring consistencyuse either UUDI or PCI bus ID, since device enumeration ordering is not guaranteed to be consistent"

This behaviour can be overridden by setting CUDA environment variables, as described here:
http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars

I would leave this just as reference in the case we need to improve the GPU pinning implementation. At the moment, the user can quickly check which GPU is using with

watch -n0.1 nvidia-smi

from galario.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.