forked from aliciayuting/CloudlabSetup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudlab_env.sh
More file actions
executable file
·63 lines (51 loc) · 2.16 KB
/
cloudlab_env.sh
File metadata and controls
executable file
·63 lines (51 loc) · 2.16 KB
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
#!/bin/bash
# Check if the OPT_HOME argument is provided
if [ -z "$1" ]; then
echo "your USER_HOME directory not provided. Please pass it as the first argument."
echo "e.g. $./cloudlab_env_setup.sh /users/[yournetid] or $./cloudlab_env_setup.sh ~"
return 1
fi
# Set OPT_HOME to the first argument
USER_HOME=$(echo "$1" | sed 's:/*$::')
OPT_HOME=${USER_HOME}/opt-dev
# Create opt-dev directory if it does not exist
if [ ! -d "$OPT_HOME" ]; then
echo "Creating $OPT_HOME directory..."
mkdir -p "$OPT_HOME"
echo "Directory created: $OPT_HOME"
else
echo "$OPT_HOME already exists. Skipping creation."
fi
# OPT_HOME=/users/[YOUR-CLOUDLAB-USER-NAME]/opt-dev
echo " .. setting up derecho cascade vortex installation env variables"
export DERECHO_INSTALL_PREFIX=${OPT_HOME}/
export DEPENDENCIES_PREFIX=${OPT_HOME}/
export CASCADE_INSTALL_PREFIX=${OPT_HOME}/
export FAISS_INSTALL_PREFIX=${OPT_HOME}/
export VORTEX_INSTALL_PREFIX=${OPT_HOME}/
export CURL_INSTALL_PREFIX=${OPT_HOME}/
export HNSWLIB_INSTALL_PREFIX=${OPT_HOME}/
export SPDLOG_PREFIX=${OPT_HOME}/
echo " .. setting up cmake cpp include path env variables"
export CMAKE_PREFIX_PATH=${OPT_HOME}:/usr/local:${CMAKE_PREFIX_PATH}
export C_INCLUDE_PATH=${OPT_HOME}/include:/usr/local/include:${C_INCLUDE_PATH}
export CPLUS_INCLUDE_PATH=${OPT_HOME}/include:/usr/local/include:${CPLUS_INCLUDE_PATH}
# Configure library paths
echo " .. setting up library path env variables"
export LIBRARY_PATH=${OPT_HOME}/lib:/usr/local/lib:${LIBRARY_PATH}
export LD_LIBRARY_PATH=${OPT_HOME}/lib:/usr/local/lib:${LD_LIBRARY_PATH}
echo " .. setting up cuda path"
export PATH=/usr/local/cuda/bin:$PATH
export PATH=$PATH:${OPT_HOME}/bin
echo "Finished setup the env path"
if [ ! -d "/mydata/.huggingface_cache" ]; then
sudo mkdir "/mydata/.huggingface_cache"
echo "Folder created for huggingface cache."
fi
export HF_HOME=/mydata/.huggingface_cache
echo "set HF_HOME to /mydata/.huggingface_cache"
# Retrieve the primary group dynamically
MYGROUP=$(id -gn)
# Change ownership using the dynamically obtained group name
sudo chown -R $USER:$MYGROUP /mydata/.huggingface_cache
echo "added ${USER}:${MYGROUP} to /mydata/.huggingface_cache"