mlcube_examples icon indicating copy to clipboard operation
mlcube_examples copied to clipboard

[WIP] Add gpus example

Open davidjurado opened this issue 2 years ago • 1 comments

GPUs example

NOTE: This example depends on: MLCUBE PR 345

Project setup

An important requirement is that you must have Docker and/or Singularity installed.

# Create Python environment and install MLCube with runners 
virtualenv -p python3 ./env && source ./env/bin/activate && pip install mlcube-docker mlcube-singularity
# Fetch the gpus example from GitHub
git clone https://github.com/mlcommons/mlcube_examples && cd ./mlcube_examples
git fetch origin pull/68/head:feature/gpu_example && git checkout feature/gpu_example
cd ./gpus/

MLCube tasks

There is only one taks that will output the variable CUDA_VISIBLE_DEVICES along with the ouput of the nvidia-smi command:

mlcube run --task=check_gpus

You can modify the number of gpus by editing the number of accelerator_count inside the mlcube.yaml file.

Also you can override the number of gpus to use by using the --gpus flag when running the command, example:

mlcube run --task=check_gpus --gpus=2

Singularity

For running on Singularity, you can define the platform while running the command as follows:

mlcube run --task=check_gpus --platform=singularity

davidjurado avatar Dec 01 '23 15:12 davidjurado

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

github-actions[bot] avatar Dec 01 '23 15:12 github-actions[bot]