"vscode:/vscode.git/clone" did not exist on "841879099cedbe15addb7f19f17e276cab5bf535"
1_base_test.sh 1.56 KB
Newer Older
chenpangpang's avatar
chenpangpang committed
1
2
#!/bin/bash

chenpangpang's avatar
chenpangpang committed
3
4
5
6
7
8
9
10
11
# 检查是否提供了输入参数
if [ -z "$1" ]; then
  echo "please set input image"
  exit 1
fi

# 检查第一个输入参数中是否包含"pytorch"字符串
if [[ "$1" == *"pytorch"* ]]; then
  docker run --rm --platform=linux/amd64 --gpus all $1  python -c \
chenpangpang's avatar
chenpangpang committed
12
13
14
15
      "import os; \
      os.system(\"cat /etc/issue\"); \
      import sys; \
      print(\"python version: \", sys.version); \
chenpangpang's avatar
chenpangpang committed
16
      import torch; \
chenpangpang's avatar
chenpangpang committed
17
18
19
20
      print(\"torch version: \", torch.__version__); \
      print(\"torch cuda available: \", torch.cuda.is_available()); \
      print(\"torch cuda version: \", torch.version.cuda); \
      print(\"torch cudnn version: \",torch.backends.cudnn.version()); \
chenpangpang's avatar
chenpangpang committed
21
      import torchvision; \
chenpangpang's avatar
chenpangpang committed
22
      print(\"torchvision version: \", torchvision.__version__); \
chenpangpang's avatar
chenpangpang committed
23
      import torchaudio; \
chenpangpang's avatar
chenpangpang committed
24
      print(\"torchaudio version: \", torchaudio.__version__);
chenpangpang's avatar
chenpangpang committed
25
26
27
28
29
30
31
32
33
34
35
36
      "
elif [[ "$1" == *"tensorflow"* ]]; then
  docker run --rm --platform=linux/amd64 --gpus all $1  python -c \
      "import os; \
      os.system(\"cat /etc/issue\"); \
      import sys; \
      print(\"python version: \", sys.version); \
      import tensorflow as tf; \
      print(\"tensorflow version: \", tf.__version__); \
      print(\"tensorflow cuda available: \", tf.test.is_gpu_available()); \
      os.system('nvcc -V | tail -n 2')
      "
chenpangpang's avatar
chenpangpang committed
37
38
39
40
elif [[ "$1" == *"paddle"* ]]; then
  TARGET_DIR=gpu-base-image-test/paddletest
  docker run --rm --platform=linux/amd64 --gpus all -v ./$TARGET_DIR:/workspace --workdir /workspace $1 python base_test.py

chenpangpang's avatar
chenpangpang committed
41
42
43
44
45
else
  echo "ERROR: no supported test shell"
  exit 1
fi