Giter Site home page Giter Site logo

Comments (1)

muellerdo avatar muellerdo commented on May 28, 2024

Hey @mcastrorennes,

the old parameter gpu_number of the Neural_Network class defines the number of gpus which will be used in parallel for multi-gpu usage. So a single model training uses multiple gpu's in order to speed up the process.

The Neural Network class used the Keras 'multi_gpu_model' function in which you can specify how many gpus you want to use. Now, this function is deprecated and was replaced with the MirroredStrategy from Tensorflow, which works more like a boolean on/off switch. Therefore, I replaced the Neural_Network class parameter gpu_number (int, by default=1) with the new variable multi_gpu (boolean, by default False).

References:
https://www.tensorflow.org/api_docs/python/tf/keras/utils/multi_gpu_model
https://www.tensorflow.org/api_docs/python/tf/distribute/MirroredStrategy
frankkramer-lab/MIScnn#44

Specify a single or multiple particular GPUs:

Could you explain to me how to set the use of a particular gpu.

If you have multiple GPUs in your cluster, let's say we have 4 GPUs, but the first two GPUs (0 & 1) are already in use by your colleague, than you have to tell your system to use only the last 2 GPUs (2 & 3).

How can we do this:

-> Via Bash:

# Define the environment variable CUDA_VISIBLE_DEVICES with a single GPU id
export CUDA_VISIBLE_DEVICES=2

# Or for multiple GPU ids
export CUDA_VISIBLE_DEVICES=2,3

-> Via Python and environment variables at the start of the script:

import os
# Single GPU ID 2
os.environ["CUDA_VISIBLE_DEVICES"] = "2"

# Multiple GPUs (2 & 3)
os.environ["CUDA_VISIBLE_DEVICES"] = "2,3"

Be aware that the Python variant requires that the ids are provided as string.

-> Via Python with Tensorflow:
Check out this:
https://www.tensorflow.org/guide/gpu#using_a_single_gpu_on_a_multi-gpu_system

Hope that I was able to help you.

Cheers,
Dominik

from covid19.miscnn.

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.