-
Notifications
You must be signed in to change notification settings - Fork 0
/
set-env.sh
executable file
·68 lines (58 loc) · 1.76 KB
/
set-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
#!/bin/bash
# get name of the environment by current folder
env_name=${PWD##*/}
# try to activate environment
source activate $env_name > /dev/null 2>&1
# get return code of activation
OUT=$?
# Add R channel
conda config --add channels r > /dev/null 2>&1
# check which os we're on
case "$OSTYPE" in
darwin*) environment=".environment.osx.yml" ;;
linux*) environment=".environment.linux.yml" ;;
esac
# create environment if it does not exist or create is supplied
# this install packages as well
if [[ ($OUT -eq 1) || ($1 == "create") || ($1 == "install") ]]; then
conda env create -n $env_name -f $environment
# if [ $? -ne 0 ]; then return; fi
shift
fi
# update packages
if [[ $1 == "update" ]]; then
conda env update --name=$env_name --file=$environment
shift
fi
# check the return code of operations
OUT=$?
if [[ ! ($OUT -eq 1) ]]; then
source activate $env_name
# set alias for waf
alias waf="python waf.py"
# Set the default Waf configuration to 'bld'.
export WAFLOCK=.lock-wafbld
# Disable Cudasim
export NUMBA_ENABLE_CUDASIM=0
# Change the Waf configuration for debug mode (adjust as it fits your project).
while [[ $# > 0 ]]
do
key="$1"
case $key in
-d|--debug-cuda)
export WAFLOCK=.lock-wafbld_debug_cuda
export NUMBA_ENABLE_CUDASIM=1
echo -e "\n\n\nUsing debug-cuda setting.\n\nSlooooooow, only use for testing.\n\n\n"
shift
;;
-c|--check-env-via-picky)
picky
;;
*)
echo "Unkown option: " $key
shift
;;
esac
shift
done
fi