Skip to content

Commit

Permalink
MRG: Merge branch main into features/melinatorcosiupdates
Browse files Browse the repository at this point in the history
  • Loading branch information
zoglauer committed Sep 27, 2023
2 parents 86b5459 + 9798106 commit a530325
Show file tree
Hide file tree
Showing 48 changed files with 992 additions and 380 deletions.
36 changes: 32 additions & 4 deletions bin/mcosima
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ echo "TAGS=( )" >> ${KillFileName}


# Start the sims
FirstTag=""
for (( i=1; i <= ${Threads}; i+=1 )); do
# First check if we are ready to launch a new thread
mwait -i=${Max} -p=cosima
Expand Down Expand Up @@ -429,6 +430,10 @@ for (( i=1; i <= ${Threads}; i+=1 )); do
sleep ${Delay}

echo "TAGS+=( ${Tag} )" >> ${KillFileName}

if [[ ${FirstTag} == "" ]]; then
FirstTag=${Tag}
fi
done

cat >> ${KillFileName} <<EOF
Expand Down Expand Up @@ -477,10 +482,33 @@ if [[ ${Concatenate} == yes ]]; then
fi

# Wait until the first such file is created
while ( test ! -f ${FirstFileName} ); do
sleep 1
echo "Waiting for the simulation file \"${FirstFileName}\" to appear ..."
done
FirstPID=$(ps -Af | grep "[ ]${FirstTag}" | grep -v "bash -c " | awk '{ print $2 }')
if [[ ${FirstPID} == "" ]] && [ ! -f ${FirstFileName} ]; then
echo ""
echo "Error:"
echo "Cosima is not running, and no sim file has been created."
echo "Most likely cosima has crashed during startup."
echo "Please do a test run with just cosima before running mcosima."
echo ""
echo "Exiting"
exit 1
else
while [[ ${FirstPID} == "" ]] && [ ! -f ${FirstFileName} ]; do
sleep 1
echo "Waiting for the simulation file \"${FirstFileName}\" to appear ..."
FirstPID=$(ps -Af | grep "[ ]${FirstTag}" | grep -v "bash -c " | awk '{ print $2 }')
done
fi

if [ ! -f ${FirstFileName} ]; then
echo ""
echo "Error:"
echo "No sim file has been created."
echo "Please do a test run with just cosima before running mcosima,"
echo ""
echo "Exiting"
exit 1
fi

# Wait until the header is written
if [[ "${Zip}" == "yes" ]]; then
Expand Down
54 changes: 54 additions & 0 deletions bin/megalib-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# Tool to check the configuration used to compile MEGAlib

commandhelp() {
echo ""
echo "megalib-config";
echo "Copyright by Andreas Zoglauer"
echo ""
echo "Shows MEGAlib configuration options"
echo ""
echo "Usage: megalib-config [options]";
echo ""
echo "Options:"
echo " --compiler : Version of the compiler used during configuration"
echo " --python3 : Version of python3 used during configuration"
echo " --root : Version of ROOT used during configuration"
echo " --geant4 : Version of Geant4 used during configuration"
echo " --help : Show this help"
echo ""
}


# Store command line as array
CMD=( "$@" )
MACHINESSTRING=""

# Check for help
for C in "${CMD[@]}"; do
if [[ ${C} == --help ]]; then
echo ""
commandhelp
exit 0
fi
done


for C in "${CMD[@]}"; do
if [[ ${C} == --compiler ]]; then
cat $MEGALIB/config/Configuration.txt | grep "COMPILER" | awk -F= '{print $2}'
elif [[ ${C} == --python3 ]]; then
cat $MEGALIB/config/Configuration.txt | grep "PYTHON3" | awk -F= '{print $2}'
elif [[ ${C} == --root ]]; then
cat $MEGALIB/config/Configuration.txt | grep "ROOT" | awk -F= '{print $2}'
elif [[ ${C} == --geant4 ]]; then
cat $MEGALIB/config/Configuration.txt | grep "GEANT4" | awk -F= '{print $2}'
elif [[ ${C} == *-h* ]]; then
echo ""
commandhelp
exit 0
fi
done

exit 0
2 changes: 1 addition & 1 deletion bin/mlines
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cd ${DIR}

CMD=" "
TOTAL=0
TYPES="cxx cc f hh h C cpp"
TYPES="cxx cc f hh h C cpp sh"
for TYPE in ${TYPES}; do
for FILE in `find . -name "*.${TYPE}"`; do
LINES=`grep -v '^\s*$' ${FILE} | grep -v '////' | wc -l`
Expand Down
1 change: 1 addition & 0 deletions bin/mresponsecreator
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ else
nice -19 responsecreator -f ${SINGLEFILE} -r ${OUT} ${NEWCMD} &> /dev/null &
fi
echo "Started run ${COUNTER} out of ${COUNTERMAX} with ID ${ID}"
sleep 1

COUNTER=$(( ${COUNTER} + 1 ))
done
Expand Down
16 changes: 13 additions & 3 deletions bin/mrevan
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ help() {
echo " -n <nice>: The nice level as an integer (default: 0)"
echo " -c <file name>: Revan configuration file name (mandatory)"
echo " -g <geometry file name>: Overwrites the geometry in the configuration file (optional)"
echo " -o: Save origin information (for response creation)"
echo " -f <file name>: Long list of sim/evta files - MUST BE LAST"
echo "";
echo "Example:";
Expand All @@ -34,6 +35,7 @@ NICELEVEL=0
CFG=""
FILES=""
GEOMETRY=""
ORIGIN="FALSE"

# Find the default number of threads
if [[ ${OSTYPE} == darwin* ]]; then
Expand All @@ -56,6 +58,9 @@ while [ $# -gt 0 ] ; do
-h|--help)
help;
exit 0;;
-o)
ORIGIN="TRUE"
;;
-t)
shift;
if [ $# -eq 0 ]; then
Expand Down Expand Up @@ -114,7 +119,7 @@ while [ $# -gt 0 ] ; do
exit 0;
fi
while [ $# -ne 0 ]; do
FILES+=" "$1;
FILES+="$1 ";
shift;
done
;;
Expand Down Expand Up @@ -165,17 +170,22 @@ echo " "
echo "Number of threads to use: ${THREADS}"
echo "Nice level: ${NICELEVEL}"
if [[ ${GEOMETRY} != "" ]]; then
echo "Geometry: ${GEOMETRY}"
echo "Geometry: ${GEOMETRY}"
fi
echo "Revan configuration file: ${CFG}"
echo "Origin info: ${ORIGIN}"
echo "Sim/evta files: ${FILES}"


# Now run, revan RUN!
for SIMFILE in ${FILES}; do
mwait -p=revan -i=${THREADS}
echo "Launching revan for file ${SIMFILE}"
CMD="source ${MEGALIB}/bin/source-megalib.sh; revan -c ${CFG} -a -n -f ${SIMFILE}"
OPTIONS="-c ${CFG} -a -n "
if [[ ${ORIGIN} == "TRUE" ]]; then
OPTIONS+="--oi "
fi
CMD="source ${MEGALIB}/bin/source-megalib.sh; revan ${OPTIONS} -f ${SIMFILE}"
if [[ ${GEOMETRY} != "" ]]; then
CMD+=" -g ${GEOMETRY}"
fi
Expand Down
2 changes: 1 addition & 1 deletion config/Makefile.linuxgcc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#----------------------------------------------------------------


CMODE = "Linux with gcc and support for C++11"
CMODE = "Linux with gcc utilizing C++14"
DLL = so

# Basic flags generated by ROOT
Expand Down
17 changes: 14 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ confhelp() {
echo " "
echo "--debug=[off/no, on/yes, strong/hard]"
echo " Default is on."
echo " Strong enables the address sanitizer on Linux with gcc to detect memory access errors."
echo " "
echo "--compiler=[gcc, clang, icc]"
echo " This currently only works on Linux. Default is gcc. On a Mac always the default compiler is used."
Expand Down Expand Up @@ -483,9 +484,9 @@ if [[ ${DEBUG} == normal ]] || [[ ${DEBUG} == strong ]]; then
OPTIONS+=" -g"
if [[ ${DEBUG} == strong ]]; then
OPTIONS+=" -DDEBUG1"
fi
if [[ ${COMP} == gcc ]] && [[ ${OS} == linux ]]; then
OPTIONS+=" -fstack-protector-all"
if [[ ${COMP} == gcc ]] && [[ ${OS} == linux ]]; then
OPTIONS+=" -fsanitize=address"
fi
fi
fi

Expand Down Expand Up @@ -623,6 +624,16 @@ echo ""
echo "Removing old build..."
make clean

# Store configuration
echo ""
echo "Storing configuration..."
rm -f config/Configuration.txt
echo "COMPILER=$(gcc --version | head -n 1)" >> config/Configuration.txt
echo "PYTHON3=$(python3 --version)" >> config/Configuration.txt
echo "ROOT=$(root-config --version)" >> config/Configuration.txt
echo "GEANT4=$(geant4-config --version)" >> config/Configuration.txt


echo ""
echo ""
echo "Done! Now type 'make' to compile and link MEGAlib"
Expand Down
6 changes: 6 additions & 0 deletions resource/examples/advanced/Atmosphere/make_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@


for P in `ls *.cxx`; do
make -f ${MEGALIB}/resource/standalone/Makefile.standalone PRG=${P}
done

8 changes: 6 additions & 2 deletions resource/examples/benchmarks/Benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,12 @@
FontScaler = 0.5

matplotlib.rcParams.update({'font.size': FontScaler*18})
matplotlib.rcParams.update({'axes.titlesize': FontScaler*30})
matplotlib.rcParams.update({'axes.labelsize': FontScaler*24})
matplotlib.rcParams.update({'axes.titlesize': FontScaler*32})
matplotlib.rcParams.update({'axes.labelsize': FontScaler*24})
if len(Reference) <= 8:
matplotlib.rcParams.update({'xtick.labelsize': FontScaler*18})
else:
matplotlib.rcParams.update({'xtick.labelsize': FontScaler*18*8/len(Reference)})
matplotlib.rcParams.update({'figure.figsize': [12.0, 6.0]})

x = np.arange(len(Labels)) # the label locations
Expand Down
7 changes: 5 additions & 2 deletions resource/examples/benchmarks/Benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ checkload() {
}


# For compatibility with macOS Catalina, compile a little C++ program to get the time in milliseconds
# For compatibility with macOS, compile a little C++ program to get the time in milliseconds

TempEXE=$(mktemp)
TimerC="${TempEXE}.cpp"
Expand Down Expand Up @@ -49,9 +49,12 @@ if [[ $(uname -s) == Linux ]]; then

CPUModel=$( lscpu | grep "Model name" | awk -F: '{print $2 }' | sed -e 's/^[[:space:]]*//' )
CPUSockets=$( lscpu | grep "Socket" | awk -F: '{print $2 }' | sed -e 's/^[[:space:]]*//' )
if ! [[ ${CPUSockets} =~ ^?[0-9]+$ ]]; then
if ! [[ ${CPUSockets} =~ ^[0-9]+$ ]]; then
CPUSockets=1
fi
if [[ ${CPUSockets} == "0" ]]; then
CPUSockets=1
fi
CPUCoresPerSocket=$( lscpu | grep "per socket" | awk -F: '{print $2 }' | sed -e 's/^[[:space:]]*//' )
if [[ ${CPUCoresPerSocket} == "" ]]; then
CPUCoresPerSocket=$( lscpu | grep "per cluster" | awk -F: '{print $2 }' | sed -e 's/^[[:space:]]*//' )
Expand Down
47 changes: 47 additions & 0 deletions resource/examples/benchmarks/References/callisto.bm
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Benchmark summary file

HostName: callisto

OSFlavour: ubuntu
OSVersion: 22.04
Kernel: 5.19.0-46-generic

CPUModel: Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
CPUName: i7-4558U
CPUSockets: 1
CPUCoresPerSocket: 2
CPUThreadsPerCore: 2
Cores: 2
Threads: 4

ROOTVersion: 6.28/04
Geant4Version: 10.2.3

MEGAlibVersion: 3.99.02
MEGAlibGitHash: 08b49f84e201ebaf3691011a9fceaec3c65daaa5 2023-07-10
MEGAlibOptimization: -O -DNDEBUG

# Cosima
DurationCosimaSingle: 36.294
EventsPerSecondCosimaSingle: 2755.276
DurationCosimaMultiple: 63.256
EventsPerSecondCosimaMultiple: 6323.510

# Revan
DurationRevanSingle: 8.409
EventsPerSecondRevanSingle: 11892.020
DurationRevanMultiple: 12.547
EventsPerSecondRevanMultiple: 31880.130

# ResponseCreator
DurationResponseCreatorSingle: 18.994
EventsPerSecondResponseCreatorSingle: 5264.820
DurationResponseCreatorMultiple: 42.131
EventsPerSecondResponseCreatorMultiple: 9494.196

# MimrecImaging
DurationMimrecImagingSingle: 70.112
EventsPerSecondMimrecImagingSingle: 1426.289
DurationMimrecImagingMultiple: 33.153
EventsPerSecondMimrecImagingMultiple: 3016.318

47 changes: 47 additions & 0 deletions resource/examples/benchmarks/References/io.bm
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Benchmark summary file

HostName: io

OSFlavour: macOS
OSVersion: 13.4.1
Kernel: 22.5.0

CPUModel: Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz
CPUName: i5-2415M
CPUSockets: 1
CPUCoresPerSocket: 2
CPUThreadsPerCore: 2
Cores: 2
Threads: 4

ROOTVersion: 6.28/04
Geant4Version: 10.2.3

MEGAlibVersion: 3.99.02
MEGAlibGitHash: ab0bd75a1f7945060fbe97ed19a6e7209a7efb7d 2023-07-10
MEGAlibOptimization: -O -DNDEBUG

# Cosima
DurationCosimaSingle: 68.194
EventsPerSecondCosimaSingle: 1466.404
DurationCosimaMultiple: 118.714
EventsPerSecondCosimaMultiple: 3369.442

# Revan
DurationRevanSingle: 19.238
EventsPerSecondRevanSingle: 5198.045
DurationRevanMultiple: 18.737
EventsPerSecondRevanMultiple: 21348.134

# ResponseCreator
DurationResponseCreatorSingle: 33.686
EventsPerSecondResponseCreatorSingle: 2968.592
DurationResponseCreatorMultiple: 65.550
EventsPerSecondResponseCreatorMultiple: 6102.212

# MimrecImaging
DurationMimrecImagingSingle: 103.211
EventsPerSecondMimrecImagingSingle: 968.888
DurationMimrecImagingMultiple: 48.047
EventsPerSecondMimrecImagingMultiple: 2081.295

Loading

0 comments on commit a530325

Please sign in to comment.