Commit d6036a92 authored by iker_martin's avatar iker_martin
Browse files

Modified locations of Exec scripts. Created script for preprocessing data.

parent 1b43c2cb
#!/bin/bash
# Runs in a given current directory all .ini files
# Parameter 1(Optional) - Amount of executions per file. Must be a positive number
#====== Do not modify these values =======
numP=$1
cores=$2
nodelist=$3
initial_node_qty=$(($numP / $cores))
if [ $initial_node_qty -eq 0 ]
then
initial_node_qty=1
fi
common_node_name="n" #FIXME What if it uses another type of node?
if [[ $nodelist == *"["* ]]; then
common_node_name=$(echo $nodelist | cut -d '[' -f1)
fi
node_array=($(echo $nodelist | sed -e 's/[\[n]//g' -e 's/\]/ /g' -e 's/,/ /g'))
actual_node_qty=0
for ((i=0; $actual_node_qty<$initial_node_qty; i++))
do
element=($(echo ${node_array[$i]} | sed -e 's/-/ /g'))
nodes_qty=1
if [ "${#element[@]}" -gt 1 ];
then
nodes_qty=$((10#${element[1]}-10#${element[0]}+1))
fi
expected_node_qty=$(($actual_node_qty + $nodes_qty))
if [ "$expected_node_qty" -le "$initial_node_qty" ];
then
added_qty=$nodes_qty
actual_node_qty=$expected_node_qty
else
added_qty=$(($initial_node_qty - $actual_node_qty))
actual_node_qty=$initial_node_qty
fi
for ((j=0; j<$added_qty; j++))
do
index=$((10#${element[0]} + $j))
index=0$index # FIXME What if there are more than 9 nodes?
#FIXME What if less than $cores have to be spawned?
for ((core=0; core<$cores; core++)) # FIXME What if the user asks for a spread distribution
do
initial_nodelist="${initial_nodelist:+$initial_nodelist,}"$common_node_name$index
done
done
done
#Print result
echo $initial_nodelist
import sys
import glob
import numpy as np
import pandas as pd
from enum import Enum
class G_enum(Enum):
TOTAL_RESIZES = 0
TOTAL_GROUPS = 1
SDR = 2
ADR = 3
DR = 4
RED_METHOD = 5
RED_STRATEGY = 6
SPAWN_METHOD = 7
SPAWN_STRATEGY = 8
GROUPS = 9
ITERS = 10
T_SPAWN = 11
T_SR = 12
T_AR = 13
T_MALLEABILITY = 14
T_TOTAL = 15
#Malleability specific
NP = 0
NC = 1
columnsG = ["Total_Resizes", "Total_Groups", "SDR", "ADR", "DR", "Redistribution_Method", \
"Redistribution_Strategy", "Spawn_Method", "Spawn_Strategy", "Groups", \
"Iters", "T_spawn", "T_SR", "T_AR", "T_Malleability", "T_total"] #16
#-----------------------------------------------
# Obtains the value of a given index in a splited line
# and returns it as a float values if possible, string otherwise
def get_value(line, index, separator=True):
if separator:
value = line[index].split('=')[1].split(',')[0]
else:
value = line[index]
try:
value = float(value)
if value.is_integer():
value = int(value)
except ValueError:
return value
return value
#-----------------------------------------------
def record_config_line(lineS, aux_data):
aux_data[0] = int(lineS[1].split("=")[1])
aux_data[1] = int(lineS[2].split("=")[1])
aux_data[2] = int(lineS[3].split("=")[1])
aux_data[3] = int(lineS[4])
aux_data[4] = int(lineS[5])
aux_data[5] = int(lineS[7].split("=")[1])
# SM RM SS
# 0 1 2 3 4 5
#Test numP=160 numC=120 Meths=0 0 1 -- Is_synch=1 qty=5
# 0 1 2 3 4 5 6 7 8
#-----------------------------------------------
# Obtains the general parameters of an execution and
# stores them for creating a global dataframe
def record_new_line(lineS, dataG_it, data_aux):
offset_line = 2
sdr = 3947883504
adr = sdr * 0.966
dataG_it[G_enum.TOTAL_RESIZES.value] = 1
dataG_it[G_enum.TOTAL_GROUPS.value] = dataG_it[G_enum.TOTAL_RESIZES.value]+1
# Init lists for each column
array_groups = [G_enum.GROUPS.value, G_enum.ITERS.value, G_enum.RED_METHOD.value, \
G_enum.RED_STRATEGY.value, G_enum.SPAWN_METHOD.value, G_enum.SPAWN_STRATEGY.value]
array_resizes = [ G_enum.T_SPAWN.value, G_enum.T_SR.value, G_enum.T_AR.value, G_enum.T_MALLEABILITY.value]
for index in array_groups:
dataG_it[index] = [None]*dataG_it[G_enum.TOTAL_GROUPS.value]
for index in array_resizes:
dataG_it[index] = [None]*dataG_it[G_enum.TOTAL_RESIZES.value]
dataG_it[G_enum.GROUPS.value][0] = data_aux[0]
dataG_it[G_enum.GROUPS.value][1] = data_aux[1]
dataG_it[G_enum.ITERS.value][0] = dataG_it[G_enum.ITERS.value][1] = 500
dataG_it[G_enum.SPAWN_METHOD.value][0] = dataG_it[G_enum.RED_METHOD.value][0] = 0
dataG_it[G_enum.SPAWN_METHOD.value][1] = data_aux[2]
dataG_it[G_enum.RED_METHOD.value][1] = data_aux[3]
dataG_it[G_enum.SPAWN_STRATEGY.value][0] = dataG_it[G_enum.RED_STRATEGY.value][0] = 1
dataG_it[G_enum.SPAWN_STRATEGY.value][1] = dataG_it[G_enum.RED_STRATEGY.value][1] = data_aux[4]
dataG_it[G_enum.SDR.value] = sdr
dataG_it[G_enum.ADR.value] = 0
if data_aux[5] == 0: #Is asynch send
dataG_it[G_enum.ADR.value] = adr
dataG_it[G_enum.SDR.value] -= adr
dataG_it[G_enum.DR.value] = dataG_it[G_enum.SDR.value] + dataG_it[G_enum.ADR.value]
#-----------------------------------------------
def record_time_line(lineS, dataG_it):
T_names = ["T_spawn:", "T_SR:", "T_AR:", "T_Malleability:", "T_total:"]
T_values = [G_enum.T_SPAWN.value, G_enum.T_SR.value, G_enum.T_AR.value, G_enum.T_MALLEABILITY.value, G_enum.T_TOTAL.value]
if not (lineS[0] in T_names): # Execute only if line represents a Time
return
index = T_names.index(lineS[0])
index = T_values[index]
offset_lines = 1
len_index = 1
if dataG_it[index] != None:
len_index = len(dataG_it[index])
for i in range(len_index):
dataG_it[index][i] = get_value(lineS, i+offset_lines, False)
else:
dataG_it[index] = get_value(lineS, offset_lines, False)
#-----------------------------------------------
def read_global_file(f, dataG, it):
runs_in_file=0
aux_data = [0,0,0,0,0,0]
for line in f:
lineS = line.split()
if len(lineS) > 0:
if lineS[0] == "Test": # CONFIG LINE
record_config_line(lineS, aux_data)
elif lineS[0] == "Start":
it += 1
runs_in_file += 1
group = 0
dataG.append([None]*len(columnsG))
record_new_line(lineS, dataG[it], aux_data)
elif it>-1:
print(lineS)
print("== "+ str(it) + " "+str(runs_in_file) )
record_time_line(lineS, dataG[it])
return it,runs_in_file
#-----------------------------------------------
def convert_to_tuples(dfG):
array_list_items = [G_enum.GROUPS.value, G_enum.ITERS.value, \
G_enum.RED_METHOD.value, G_enum.RED_STRATEGY.value, G_enum.SPAWN_METHOD.value, \
G_enum.SPAWN_STRATEGY.value, G_enum.T_SPAWN.value, G_enum.T_SR.value, \
G_enum.T_AR.value, G_enum.T_MALLEABILITY.value]
for item in array_list_items:
name = columnsG[item]
values = dfG[name].copy()
for index in range(len(values)):
values[index] = tuple(values[index])
dfG[name] = values
#-----------------------------------------------
if len(sys.argv) < 2:
print("The files name is missing\nUsage: python3 MallTimes.py commonName directory OutName")
exit(1)
common_name = sys.argv[1]
if len(sys.argv) >= 3:
BaseDir = sys.argv[2]
print("Searching in directory: "+ BaseDir)
else:
BaseDir = "./"
if len(sys.argv) >= 4:
name = sys.argv[3]
else:
name = "data"
print("File name will be: " + name + "G.pkl")
lista = (glob.glob(BaseDir + common_name + "*.out")) # Se utiliza cuando solo hay un nivel de directorios
print("Number of files found: "+ str(len(lista)));
it = -1
dataG = []
for elem in lista:
f = open(elem, "r")
it,runs_in_file = read_global_file(f, dataG, it)
f.close()
dfG = pd.DataFrame(dataG, columns=columnsG)
convert_to_tuples(dfG)
print(dfG)
dfG.to_pickle(name + 'G.pkl')
#dfM = pd.DataFrame(dataM, columns=columnsM)
#Poner en TC el valor real y en TH el necesario para la app
#cond = dfM.TH != 0
#dfM.loc[cond, ['TC', 'TH']] = dfM.loc[cond, ['TH', 'TC']].values
#dfM.to_csv(name + 'M.csv')
......@@ -7,7 +7,6 @@
dirCG="/home/martini/malleable_cg"
module load /home/martini/MODULES/modulefiles/mpich-4.0.3-ofi
module load /home/martini/MODULES/modulefiles/intel64Only.module
nodelist=$SLURM_JOB_NODELIST
nodes=$SLURM_JOB_NUM_NODES
......@@ -28,3 +27,6 @@ do
mpirun -hosts $initial_nodelist -np $numP $dirCG/build/a.out $matrix $numC $msm $mss $mrm $mss $is_sync $nodelist $nodes
done
echo "End"
sed -i 's/application called MPI_Abort(MPI_COMM_WORLD, -100) - process/shrink cleaning/g' slurm-$SLURM_JOB_ID.out
sed -i 's/Abort(-100)/shrink cleaning/g' slurm-$SLURM_JOB_ID.out
......@@ -2,7 +2,7 @@
#SBATCH -N 1
#SBATCH -p P1
#SBATCH -t 00:10:00
#SBATCH -t 00:30:00
dirM="/home/martini/SparseMatrix/"
dirCG="/home/martini/malleable_cg"
......@@ -11,27 +11,20 @@ matrix="Queen_4147.rb"
#matrix="bcsstk01.rsa"
module load /home/martini/MODULES/modulefiles/mpich-4.0.3-ofi
module load /home/martini/MODULES/modulefiles/intel64Only.module
nodelist=$SLURM_JOB_NODELIST
nodes=$SLURM_JOB_NUM_NODES
cores=20
numP=$1
numC=40
msm=0
mss=1
mrm=0
send_sync=1
numC=$2
msm=$3
mss=$5
mrm=$4
send_sync=$6
initial_nodelist=$(bash BashScripts/createInitialNodelist.sh $numP $cores $nodelist)
echo "Test"
mpirun -hosts $initial_nodelist -np $numP ./build/a.out $dirM/$matrix $numC $msm $mss $mrm $mss $send_sync $nodelist $nodes
initial_nodelist=$(bash $dirCG/BashScripts/createInitialNodelist.sh $numP $cores $nodelist)
echo "Test numP=$numP numC=$numC Meths=$msm $mrm $mss -- Is_synch=$send_sync qty=$qty"
mpirun -hosts $initial_nodelist -np $numP $dirCG/build/a.out $dirM/$matrix $numC $msm $mss $mrm $mss $send_sync $nodelist $nodes
#mpirun -np 4 ./ConjugateGradient bcsstk17.rsa
#mpirun -np 8 ./ConjugateGradient bcsstk01.rsa
#mpirun -np 12 ./ConjugateGradient bcsstk01.rsa
echo "AUDIK"
#mpirun -np 4 ./ConjugateGradient ../../audikw_1/audikw_1.rb
#mpirun -np 4 ./ConjugateGradient ../../audikw_1/audikw_1.rb
#mpirun -np 4 ./ConjugateGradient ../../audikw_1/audikw_1.rb
echo "End"
......@@ -6,8 +6,8 @@ matrix="Queen_4147.rb"
#matrix="audikw_1.rb"
#matrix="bcsstk01.rsa"
procs=(2 10 20 40 80 120 160)
#procs=(2 4)
#procs=(2 10 20 40 80 120 160)
procs=(160 120 80 40 20 10 2)
msm=(0 1)
mss=(1 2)
mrm=(0 1)
......@@ -46,11 +46,11 @@ do
do
if [ $is_sync -eq 1 ] # Matrix is send syncrhonously
then
sbatch -p P1 -N $node_qty $dirCG/generalRun.sh $proc $dirM$matrix $proc_c $sm_type 1 $rm_type 1 $is_sync $qty
sbatch -p P1 -N $node_qty $dirCG/Exec/generalRun.sh $proc $dirM$matrix $proc_c $sm_type 1 $rm_type 1 $is_sync $qty
else # Matrix is send asyncrhonously
for ss_type in "${mss[@]}"
do
sbatch -p P1 -N $node_qty $dirCG/generalRun.sh $proc $dirM$matrix $proc_c $sm_type $ss_type $rm_type $ss_type $is_sync $qty
sbatch -p P1 -N $node_qty $dirCG/Exec/generalRun.sh $proc $dirM$matrix $proc_c $sm_type $ss_type $rm_type $ss_type $is_sync $qty
done
fi
done
......
#!/bin/bash
#SBATCH -N 1
#SBATCH -p P1
#SBATCH -t 00:10:00
module load /home/martini/MODULES/modulefiles/mpich-4.0.3-ofi
module load /home/martini/MODULES/modulefiles/intel64Only.module
nodelist=$SLURM_JOB_NODELIST
nodes=$SLURM_JOB_NUM_NODES
cores=20
numP=$1
numC=2
msm=0
mss=2
mrm=1
send_sync=0
initial_nodelist=$(bash BashScripts/createInitialNodelist.sh $numP $cores $nodelist)
echo "Test"
mpirun -hosts $initial_nodelist -np $numP valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --trace-children=yes --log-file=nc.vg.%p ./build/a.out bcsstk01.rsa $numC $msm $mss $mrm $mss $send_sync
Supports Markdown
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