Skip to content

Commit

Permalink
ci: gpu split sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Feb 9, 2023
1 parent 136feef commit 7acaf26
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .azure/testing-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,23 @@ jobs:
options: "--gpus=all --shm-size=8g -v /usr/bin/docker:/tmp/docker:ro"
steps:

- bash: |
echo "##vso[task.setvariable variable=CONTAINER_ID]$(head -1 /proc/self/cgroup|cut -d/ -f3)"
echo "##vso[task.setvariable variable=CUDA_VISIBLE_DEVICES]$(DEVICES)"
displayName: 'Set environment variables'
- bash: |
whoami && id
lspci | egrep 'VGA|3D'
whereis nvidia
nvidia-smi
echo $CUDA_VISIBLE_DEVICES
echo $CONTAINER_ID
python --version
pip --version
pip list
python -c "import torch ; print(torch.cuda.get_arch_list())"
echo "##vso[task.setvariable variable=CUDA_VISIBLE_DEVICES]$(DEVICES)"
displayName: 'Image info & NVIDIA'
- script: |
/tmp/docker exec -t -u 0 $CONTAINER_ID \
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
container_id=$(head -1 /proc/self/cgroup|cut -d/ -f3)
/tmp/docker exec -t -u 0 $container_id \
sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
echo "##vso[task.setvariable variable=CONTAINER_ID]$container_id"
displayName: 'Install Sudo in container (thanks Microsoft!)'
- bash: |
Expand All @@ -82,6 +78,8 @@ jobs:
displayName: 'Install dependencies'
- bash: |
echo $CUDA_VISIBLE_DEVICES
echo $CONTAINER_ID
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu > 0, f'GPU: {mgpu}'"
displayName: 'Sanity check'
Expand Down

0 comments on commit 7acaf26

Please sign in to comment.