-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathenv.sh
executable file
·112 lines (100 loc) · 3.56 KB
/
env.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
# A library to display spinorama charts
#
# Copyright (C) 2020-2024 Pierre Aubert pierre(at)spinorama(dot)org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
touch env.log
## SSH AGENT
## ----------------------------------------------------------------------
ssh-agent -k >> env.log 2>&1
eval $(ssh-agent)
echo $SSH_AGENT_SOCK
if ! test -f ~/.ssh/id_rsa_github; then
echo "ERROR github key don't exists!"
fi
## Github keys
## ----------------------------------------------------------------------
github=$(ssh-add -l | grep github | cut -d ' ' -f 3)
if test -z $github; then
ssh-add ~/.ssh/id_rsa_github >> env.log 2>&1
github=$(ssh-add -l 2>&1 | grep github | cut -d ' ' -f 3)
fi
## prod keys
## ----------------------------------------------------------------------
RSA_ES=$HOME/.ssh/id_rsa_es_web
if test -f $RSA_ES; then
ssh-add $RSA_ES >> env.log 2>&1
fi
RSA_CH=$HOME/.ssh/id_rsa_ch_web
if test -f $RSA_CH; then
ssh-add $RSA_CH >> env.log 2>&1
fi
## python virtualenv
## ----------------------------------------------------------------------
SPIN=$PWD
export PYTHONPATH=$SPIN/src:$SPIN/src/website:$SPIN
if ! test -d "$SPIN/.venv"; then
python3 -m venv .venv
source "$SPIN/.venv/bin/activate"
# rehash
pip3 install -U pip
pip3 install -r requirements.txt
pip3 install -r requirements-test.txt
pip3 install -r requirements-dev.txt
fi
source .venv/bin/activate
## ray configuration
## ---------------------------------------------------------------------
if test "$(hostname)" = "horn"; then
# remove a warning from Ray since horn has 128 threads
export NUMEXPR_MAX_THREADS=96
fi
## node install
## ----------------------------------------------------------------------
if ! test -d "$SPIN/node_modules"; then
npm install .
fi
export PATH=$PATH:$SPIN/node_modules/.bin
## CUDA configuration
## ----------------------------------------------------------------------
CUDA=""
if test -x /usr/bin/nvidia-smi; then
CUDA="$(nvidia-smi -L)"
fi
if test -d /usr/local/cuda/extras/CUPTI/lib64; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64
fi
## ROCM/HIP configuration
## ----------------------------------------------------------------------
ROCM=""
if test -x /usr/bin/rocminfo; then
ROCM="$(rocminfo | grep 'Marketing Name' | grep Radeon | cut -d: -f 2 | sed -e 's/ //g')"
fi
if test -d /usr/local/cuda/extras/CUPTI/lib64; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64
fi
# for deepsource code coverage
export DEEPSOURCE_DSN=https://[email protected]
## summary
## ----------------------------------------------------------------------
echo 'SPIN ' "$SPIN"
echo ' ' "$(python3 --version) $(which python3)"
echo ' ' "$(pip3 -V) "
echo ' jupyter-lab ' "$(jupyter-lab --version) $(which jupyter-lab)"
echo ' PYTHONPATH ' "$PYTHONPATH"
echo ' github key ' "$github"
echo ' CUDA (Nvidia)' "$CUDA"
echo ' ROCM (AMD) ' "$ROCM"
echo ' RAY ' "$(ray --version)"