Skip to content
Snippets Groups Projects
Commit ab3a6f5c authored by Theodore Efremov's avatar Theodore Efremov :hibiscus:
Browse files

[AlPhaPha] Adding cpu cores automatic detection

parent 964f427d
No related branches found
No related tags found
No related merge requests found
Pipeline #389066 passed
for run in {245..252}; do for run in {201..259}; do
./convert_snakemake_generic.sh "$run" ./convert_snakemake_generic.sh "$run"
wait wait
done done
...@@ -3,7 +3,7 @@ import subprocess ...@@ -3,7 +3,7 @@ import subprocess
# Lire le répertoire d'entrée depuis les arguments de configuration # Lire le répertoire d'entrée depuis les arguments de configuration
#input_directory = config["folder"] #input_directory = config["folder"]
input_directory = os.getcwd() + "/../DataMacro/output/run_252" input_directory = os.getcwd() + "/../DataMacro/output/run_247"
origin = [] origin = []
# Iterate over files in input_directory # Iterate over files in input_directory
for filename in os.listdir(input_directory): for filename in os.listdir(input_directory):
...@@ -12,14 +12,14 @@ for filename in os.listdir(input_directory): ...@@ -12,14 +12,14 @@ for filename in os.listdir(input_directory):
origin.append(filename) origin.append(filename)
# Définir le répertoire de sortie pour les fichiers convertis # Définir le répertoire de sortie pour les fichiers convertis
phy_directory = os.getcwd() + "/../DataMacro/output/analysis/run_252" phy_directory = os.getcwd() + "/../DataMacro/output/analysis/run_247"
#phy_directory = "./" #phy_directory = "./"
# define target files directory # define target files directory
analysedfile = [] analysedfile = []
for inputfile in origin: for inputfile in origin:
#analysedfile.append("/home/morfouacep/Physics/NPTool/nptool/Projects/ana_e850/root/analysis/"+inputfile.replace("_raw_","_")) #analysedfile.append("/home/morfouacep/Physics/NPTool/nptool/Projects/ana_e850/root/analysis/"+inputfile.replace("_raw_","_"))
analysedfile.append( os.getcwd() + "/../DataMacro/output/analysis/run_252/"+inputfile) analysedfile.append( os.getcwd() + "/../DataMacro/output/analysis/run_247/"+inputfile)
## batch rules ## batch rules
rule all: rule all:
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#Declare run number #Declare run number
#RUN_NUMBER="246" #RUN_NUMBER="246"
RUN_NUMBER="$1" RUN_NUMBER="$1"
num_cores=$(( $(nproc) - 4 ))
# Check if Snakefile exists # Check if Snakefile exists
if [[ ! -f "Snakefile" ]]; then if [[ ! -f "Snakefile" ]]; then
...@@ -15,13 +16,17 @@ sed -i "s/run_[a-zA-Z0-9]\{3\}/run_${RUN_NUMBER}/g" Snakefile ...@@ -15,13 +16,17 @@ sed -i "s/run_[a-zA-Z0-9]\{3\}/run_${RUN_NUMBER}/g" Snakefile
echo "All occurrences of 'run_*' have been replaced with 'run_${RUN_NUMBER}' in Snakefile." echo "All occurrences of 'run_*' have been replaced with 'run_${RUN_NUMBER}' in Snakefile."
echo "- executing snakemake file for npanalysis..." echo "- executing snakemake file for npanalysis..."
snakemake --cores 30 --forceall --keep-incomplete --keep-going --rerun-incomplete --restart-times 3 snakemake --cores ${num_cores} --forceall --keep-incomplete --keep-going --rerun-incomplete --restart-times 3
echo "- snakemake executed successfully!" echo "- snakemake executed successfully!"
echo "- Merging file..." echo "- Merging file..."
OName="\"Run${RUN_NUMBER}AoQ\"" OName="\"Run${RUN_NUMBER}\""
OPATH="\"root/analysis\"" OPATH="\"root/analysis\""
Path="\"../DataMacro/output/analysis/run_${RUN_NUMBER}/run_raw_${RUN_NUMBER}_\"" Path="\"../DataMacro/output/analysis/run_${RUN_NUMBER}/run_raw_${RUN_NUMBER}_\""
root -l -q "../DataMacro/Merger.C(30,${OPATH},${OName},${Path})" root -l -q "../DataMacro/Merger.C(30,${OPATH},${OName},${Path})"
wait
rm ../DataMacro/output/analysis/run_${RUN_NUMBER}/run_raw_*.root
...@@ -16,7 +16,7 @@ for ((i=0; i<MAX_JOBS; i++)); do ...@@ -16,7 +16,7 @@ for ((i=0; i<MAX_JOBS; i++)); do
done done
for run in {220..262}; do for run in {201..262}; do
read -u 3 # Wait for an available slot read -u 3 # Wait for an available slot
{ {
root -l -q "./Secator.C(\"/home/efremovt/Data/2to_SSD/2024/np_raw/run_raw_"$run".root\",\"output/run_"$run"/\", 30)" root -l -q "./Secator.C(\"/home/efremovt/Data/2to_SSD/2024/np_raw/run_raw_"$run".root\",\"output/run_"$run"/\", 30)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment