File size: 941 Bytes
0914710
 
 
 
 
8c1771d
0914710
 
 
 
 
8c1771d
0914710
 
8c1771d
 
 
 
0914710
 
 
 
 
8c1771d
0914710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash

WORKDIR="/var/task"
XDG_CACHE_HOME="/data"

echo "FOLDERS_MAP:${FOLDERS_MAP} ..."

source ${WORKDIR}/venv/bin/activate

which python
python --version
python ${WORKDIR}/script/create_folders_and_variables_if_not_exists.py

free -m
which nvcc || true
nvcc -V || true
which nvidia-smi || true
nvidia-smi || true
pip list

which uvicorn
ls -l ${WORKDIR}/venv/bin/uvicorn

df -h / /home ${WORKDIR} ${XDG_CACHE_HOME}

echo "WORKDIR - /var/task"
ls -l ${WORKDIR}

echo "XDG_CACHE_HOME - /data"
find ${XDG_CACHE_HOME}

CUDA_VISIBLE_DEVICES=$(nvidia-smi --query-gpu=memory.free,index --format=csv,nounits,noheader | sort -nr | head -1 | awk '{ print $NF }')
echo "calculated CUDA_VISIBLE_DEVICES env variable: ${CUDA_VISIBLE_DEVICES}."
export CUDA_VISIBLE_DEVICES

echo "running command 'uvicorn wrappers.fastapi_wrapper:app --host 0.0.0.0 --port 7860'..."
uvicorn wrappers.fastapi_wrapper:app --host 0.0.0.0 --port 7860

exit 0