Just a heads up, we don't have a huge amount of space on this machine, ~750 GB for the git repos. We can include some data in the projects, but really big datasets will need to remain elsewhere. For anyone new to Git, this is a fairly good place to start: http://gitref.org/index.html Documentation for Gitlab is available here: http://doc.gitlab.com/

Commit e2587bd1 authored by Khalid Kunji's avatar Khalid Kunji

A number of small fixes/adjusments, memory works if user writable cgroup exists

parent 626f88e7
......@@ -17,7 +17,6 @@ command -v free >/dev/null 2>&1 || { echo >&2 "free is required but not installe
command -v rev >/dev/null 2>&1 || { echo >&2 "rev is required but not installed or not in the path. Aborting."; exit 1; }
command -v seq >/dev/null 2>&1 || { echo >&2 "seq is required but not installed or not in the path. Aborting."; exit 1; }
command -v tr >/dev/null 2>&1 || { echo >&2 "tr is required but not installed or not in the path. Aborting."; exit 1; }
command -v prlimit >/dev/null 2>&1 || { echo >&2 "prlimit is recommended but not installed or not in the path. Continuing, but memory limits will be ignored"; }
command -v sort >/dev/null 2>&1 || { echo >&2 "sort is recommended but not installed or not in the path. Continuing, but behavior is undetermined"; }
command -v cgcreate >/dev/null 2>&1 || { echo >&2 "cgcreate from package cgroup-tools/libcgroups is recommended but not installed or not in the path. Continuing, but memory limits will not be imposed. See the README for more info"; }
......@@ -46,10 +45,17 @@ export long="false"
#Argument Parsing
cd "${base_path}"
if [ $# -ge 1 -a -f "${@:1:1}" ]
if [ ${debug_parsing} ]
then
echo "First Argument: ${@:1:1}"
fi
if [ $# -ge 1 -a -f "${@:1:1}" ] || [ "${@:1:1}" == "-h" ] || [ "${@:1:1}" == "-v" ]
then
param_file="${@:1:1}"
shift
if [ $# -ge 1 -a -f "${@:1:1}" ]
then
param_file="${@:1:1}"
shift
fi
index=1
for arg in "$@"
do
......@@ -142,9 +148,28 @@ shift
export long="true"
;;
v )
echo "GIGI-Quick version: 0.95"
echo "If you intended to activate verbose output, that flag is now capitalized: '-V'"
exit 0
;;
V )
echo "verbose is true"
export verbose="true"
;;
h )
echo "Help: "
echo "run_GIGI parameter_file -o [OUTPUT FOLDER] -n [RUN NAME] -t [THREADS] -m [MEMORY IN MB] [-l] [-v] [-V] [-h]"
echo "-o [OUTPUT FOLDER] : This is the path to use for the outputs from the run_GIGI scripts, including temporary files."
echo "-n [RUN NAME] : This is a path relative to the [OUTPUT FOLDER] to use to keep the outputs from more than one run of run_GIGI separated."
echo "-t [THREADS] : The number of threads to use for run_GIGI, and also the number of chunks to split the input into."
echo "-m [MEMORY IN MB] : The amount of RAM that run_GIGI will restrict its use to, please set up the cgroup first"
echo "-l : Specifies that the input is in the long format."
echo "-v : Display the version of GIGI-Quick"
echo "-V : Verbose mode, output from run_GIGI is much quiter now, you can see much more of what it is doing and what variables are set to at various stages with -v. "
echo "-h : Display this help text"
echo "For further information please see the included readme file and or the same text online on the project page: https://cse-git.qcri.org/Imputation/Impute_Beaming"
exit 0
;;
* )
echo "unknown flag: " "${arg:${j}:1}"
exit 1
......@@ -161,7 +186,7 @@ shift
done
else
echo "THE FIRST ARGUMENT ISN'T A PARAMETER FILE"
echo 'Usage: run_GIGI parameter_file -o [OUTPUT FOLDER] -n [RUN NAME] -t [THREADS] -m [MEMORY IN MB]'
echo "Usage: run_GIGI parameter_file -o [OUTPUT FOLDER] -n [RUN NAME] -t [THREADS] -m [MEMORY IN MB] [-l] [-v] [-V] [-h]"
exit 1
fi
echo
......@@ -197,7 +222,10 @@ cd "$output_folder"
export output_folder=$(pwd)
cd "$base_path"
cd "${param_file%/*}"
if [ -d "${param_file%/*}" ]
then
cd "${param_file%/*}"
fi
export param_file="$(pwd)"/"${param_file##*/}"
export input_folder="${param_file%/*}"
export gigi_split_chunks_folder="${output_folder}/${run_name}/split_output"
......
......@@ -29,10 +29,10 @@ then
echo "Host ID: " $(hostid)
echo "Uptime: " $(uptime)
fi
cores=$(lscpu | grep "Core(s)" | tail -c 2)
sockets=$(lscpu | grep "Socket(s)" | tail -c 2)
cores=$(lscpu | grep "Core(s)" | grep -o -E "[0-9]+$")
sockets=$(lscpu | grep "Socket(s)" | grep -o -E "[0-9]+$")
cores_total=$(($cores*$sockets))
threads_per_core=$(lscpu | grep Thread | tail -c 2)
threads_per_core=$(lscpu | grep Thread | grep -o -E "[0-9]+$")
threads_total=$(($cores_total*$threads_per_core))
if [ ${verbose} ]
then
......@@ -43,26 +43,23 @@ export num_chunks=$(($threads_total - $threads_per_core))
if [ "${num_threads}" ]
then
#Do Nothing
echo
#Compare with num_threads
if [ "$num_threads" -lt "$num_chunks" ]
then
export num_chunks="$num_threads"
fi
else
num_threads="$num_chunks"
fi
#Compare with num_threads
if [ "$num_threads" -lt "$num_chunks" ]
then
export num_chunks="$num_threads"
fi
if [ "$num_chunks" -lt 1 ]
then
export num_chunks=1
echo "Trouble determining number of threads correctly, using 1 as a failsafe."
fi
if [ ${verbose} ]
then
echo "Number of chunks to split into: " ${num_chunks}
echo
if [ "$num_chunks" -lt 1 ]
then
export num_chunks=1
echo "Trouble determining number of threads correctly, using 1 as a failsafe."
fi
if [ ${verbose} ]
then
echo "Number of chunks to split into: " ${num_chunks}
echo
fi
fi
#Compare with memory
......@@ -99,13 +96,14 @@ then
#Here we depend on cgroup-tools
cgcreate -g memory,cpu:user_cgroup/gigi
cgstatus=$?
echo "${cgstatus}"
echo "cgcreate return value: " "${cgstatus}"
if [ "${cgstatus}" -ne 0 ]
then
echo "memory limits not enforced, could not create cgroup, error: ${cgstatus}"
else
echo $((1024*1024*memory))
#Limit to ~2 MB
echo 2000000 > /sys/fs/cgroup/memory/user_cgroup/gigi/memory.limit_in_bytes
#echo 2000000 > /sys/fs/cgroup/memory/user_cgroup/gigi/memory.limit_in_bytes
#Limit to 200 KB
#echo 200000 > /sys/fs/cgroup/memory/test/test_limits/memory.limit_in_bytes
#Limit to ~10% of CPU (Actually 100/1024 'cpu shares')
......
......@@ -33,11 +33,16 @@ do
fi
if [[ "$long" == "true" ]]
then
echo "memory: " "${memory}"
if [ ${memory} ]
then
command -v cgexec >/dev/null 2>&1
cgexecpresent=$?
if [ ${cgexecpresent} ]
if [ ${verbose} ]
then
echo "cgexecpresent: " "${cgexecpresent}"
fi
if [ "${cgexecpresent}" -eq 0 ]
then
cgexec -g memory,cpu:user_cgroup/gigi $timecmd -o "${output_folder}/${run_name}/STATS/time${BASH_REMATCH}.log" -f'memory in kilobytes %M real %e user %U sys %S command %C' "${gigi}" "${file}" -outD="${output_folder}/${run_name}/gigi_output/${BASH_REMATCH}" -long > "${output_folder}/${run_name}/LOGS/${BASH_REMATCH}.gigi.log" & pids+=("$!")
else
......@@ -50,7 +55,13 @@ do
else
if [ ${memory} ]
then
if [ ${cgexecpresent} ]
command -v cgexec >/dev/null 2>&1
cgexecpresent=$?
if [ ${verbose} ]
then
echo "cgexecpresent: " "${cgexecpresent}"
fi
if [ "${cgexecpresent}" -eq 0 ]
then
cgexec -g memory,cpu:user_cgroup/gigi $timecmd -o "${output_folder}/${run_name}/STATS/time${BASH_REMATCH}.log" -f'memory in kilobytes %M real %e user %U sys %S command %C' "${gigi}" "${file}" -outD="${output_folder}/${run_name}/gigi_output/${BASH_REMATCH}" > "${output_folder}/${run_name}/LOGS/${BASH_REMATCH}.gigi.log" & pids+=("$!")
else
......
......@@ -15,7 +15,7 @@ else
. ./GIGI_0_parsing.sh "$@"
else
echo "NO ARGUMENTS GIVEN"
echo 'Usage: run_GIGI parameter_file -o [OUTPUT FOLDER] -n [RUN NAME] -t [THREADS] -m [MEMORY IN MB]'
echo "Usage: run_GIGI parameter_file -o [OUTPUT FOLDER] -n [RUN NAME] -t [THREADS] -m [MEMORY IN MB] [-l] [-v] [-V] [-h]"
exit 1
fi
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment