run.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. print_banner() {
  3. printf "\n\n\n\e[30m\e[42m$1\e[0m\n\n\n\n"
  4. }
  5. print_green() {
  6. printf "\e[30m\e[42m$1\e[0m\n"
  7. }
  8. print_red() {
  9. printf "\e[30m\e[41m$1\e[0m\n"
  10. }
  11. images=(
  12. "pytorch/pytorch:nightly-devel-cuda10.0-cudnn7"
  13. "pytorch/pytorch:1.1.0-cuda10.0-cudnn7.5-devel"
  14. "pytorch/pytorch:1.0.1-cuda10.0-cudnn7-devel"
  15. "pytorch/pytorch:1.0-cuda10.0-cudnn7-devel"
  16. "pytorch/pytorch:nightly-devel-cuda9.2-cudnn7"
  17. )
  18. branch="master"
  19. # Associative array for exit codes
  20. declare -A exit_codes
  21. for image in images
  22. do
  23. exit_codes[$image]="None"
  24. done
  25. for image in "${images[@]}"
  26. do
  27. print_banner "$image"
  28. set -x
  29. docker pull $image
  30. # Trying python setup.py install instead of pip install to ensure direct access to error codes.
  31. # Maybe pip install would be ok too but this works.
  32. docker run --runtime=nvidia --rm $image /bin/bash -c "yes | pip uninstall apex; yes | pip uninstall apex; git clone https://github.com/NVIDIA/apex.git; cd apex; git checkout $branch; set -e; python setup.py install --cuda_ext --cpp_ext"
  33. exit_code=$?
  34. set +x
  35. if [ $exit_code != 0 ]
  36. then
  37. print_red "Exit code: $exit_code"
  38. else
  39. print_green "Exit code: $exit_code"
  40. fi
  41. exit_codes[$image]=$exit_code
  42. done
  43. success=0
  44. for image in "${images[@]}"
  45. do
  46. exit_code=${exit_codes[$image]}
  47. if [ $exit_code != 0 ]
  48. then
  49. print_red "$image : $exit_code"
  50. success=1
  51. else
  52. print_green "$image : $exit_code"
  53. fi
  54. done
  55. if [ $success != 0 ]
  56. then
  57. print_red "Overall status: failure"
  58. else
  59. print_green "Overall status: success"
  60. fi
  61. exit $success