Skip to content
Snippets Groups Projects
Commit da0ebc7d authored by Matthieu Oberon's avatar Matthieu Oberon
Browse files

suppression varaible nb_nodes

parent d6873a19
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ import compute_tau ...@@ -8,7 +8,7 @@ import compute_tau
import launcher_SUBP import launcher_SUBP
def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3=256, def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3=256,
nb_threads=4, reps=100, nb_nodes=1,optimization="-O3", simd="avx512"): nb_threads=4, reps=100,optimization="-O3", simd="avx512"):
""" Ant colony optimization of the cache blocking parameters for the execution of """ Ant colony optimization of the cache blocking parameters for the execution of
the iso3dfd programm. the iso3dfd programm.
...@@ -27,7 +27,6 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3 ...@@ -27,7 +27,6 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3
n3 (int, optional): Third dimension of matrix. Defaults to 256. n3 (int, optional): Third dimension of matrix. Defaults to 256.
nb_threads (int, optional): Number of threads per MPI process. Defaults to 4. nb_threads (int, optional): Number of threads per MPI process. Defaults to 4.
reps (int, optional): Max number of iteration before stopping the process. Defaults to 100. reps (int, optional): Max number of iteration before stopping the process. Defaults to 100.
nb_nodes (int, optional): Number of nodes on which the iso3dfd is called. Defaults to 1.
optimization (str, optional): Optimization flaf. Defaults to "-O3". optimization (str, optional): Optimization flaf. Defaults to "-O3".
simd (str, optional): Vectorization flag. Defaults to "avx512". simd (str, optional): Vectorization flag. Defaults to "avx512".
...@@ -39,7 +38,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3 ...@@ -39,7 +38,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3
# Compiling the code # Compiling the code
launcher_SUBP.compileSUBP(optimization="-O3", simd="avx512") launcher_SUBP.compileSUBP(optimization="-O3", simd="avx512")
# Waiting for the compilation to end on other nodes # Waiting for the compilation to end on other processes
comm.barrier() comm.barrier()
# Initialisation of the graph and pheromon matrix # Initialisation of the graph and pheromon matrix
...@@ -57,7 +56,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3 ...@@ -57,7 +56,7 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3
paths = [] paths = []
costs = [] costs = []
for k in range(nb_ants//NbP): for k in range(nb_ants//NbP):
path, cost = compute_path.compute_path(tau, alpha, n1, n2, n3, nb_threads, reps, nb_nodes) path, cost = compute_path.compute_path(tau, alpha, n1, n2, n3, nb_threads, reps)
paths.append(path) paths.append(path)
costs.append(cost) costs.append(cost)
paths = np.array(paths, dtype="int32") paths = np.array(paths, dtype="int32")
...@@ -100,7 +99,6 @@ if __name__ == "__main__": ...@@ -100,7 +99,6 @@ if __name__ == "__main__":
n_iter = 5 n_iter = 5
# Parameters for compilation and execution of iso3dfd # Parameters for compilation and execution of iso3dfd
nb_nodes = 1
nb_threads = 4 nb_threads = 4
reps = 100 reps = 100
n1, n2, n3 = 256, 256, 256 n1, n2, n3 = 256, 256, 256
...@@ -109,9 +107,9 @@ if __name__ == "__main__": ...@@ -109,9 +107,9 @@ if __name__ == "__main__":
if Me == 0: if Me == 0:
path_opti, cost_opti = ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1, n2, n3, path_opti, cost_opti = ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1, n2, n3,
nb_threads, reps, nb_nodes, optimization, simd) nb_threads, reps, optimization, simd)
print(path_opti) print(path_opti)
print(cost_opti) print(cost_opti)
else: else:
ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1, n2, n3, nb_threads, reps, ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1, n2, n3, nb_threads, reps,
nb_nodes, optimization, simd) optimization, simd)
...@@ -32,7 +32,7 @@ def proba(i, alpha, tau, n_cbx, n_cby, n_cbz): ...@@ -32,7 +32,7 @@ def proba(i, alpha, tau, n_cbx, n_cby, n_cbz):
return (sequence, weights) return (sequence, weights)
def compute_path(tau, alpha, n1, n2, n3, nb_threads, reps, nb_nodes): def compute_path(tau, alpha, n1, n2, n3, nb_threads, reps):
n_cbx = n1//16 n_cbx = n1//16
n_cby = n2 n_cby = n2
n_cbz = n3 n_cbz = n3
...@@ -55,7 +55,7 @@ def compute_path(tau, alpha, n1, n2, n3, nb_threads, reps, nb_nodes): ...@@ -55,7 +55,7 @@ def compute_path(tau, alpha, n1, n2, n3, nb_threads, reps, nb_nodes):
path[2] = path[2] - n_cbx - n_cby path[2] = path[2] - n_cbx - n_cby
#we calculate the cost of this path and add it at the end of the path #we calculate the cost of this path and add it at the end of the path
cost = launcher_SUBP.deploySUBP(nb_nodes, n1, n2, n3, nb_threads, reps, path[0]*16, path[1], path[2]) cost = launcher_SUBP.deploySUBP(n1, n2, n3, nb_threads, reps, path[0]*16, path[1], path[2])
cost = [cost] cost = [cost]
print(f"Path after transformation : {path} with cost equal to {cost}.") print(f"Path after transformation : {path} with cost equal to {cost}.")
......
...@@ -9,11 +9,10 @@ import tools ...@@ -9,11 +9,10 @@ import tools
# Deployment function: launch a MPI pgm on a set of cluster nodes # Deployment function: launch a MPI pgm on a set of cluster nodes
# + get the MPI pgm output and achieve a pretty print of the perf # + get the MPI pgm output and achieve a pretty print of the perf
#---------------------------------------------------------------- #----------------------------------------------------------------
def deploySUBP(nb_nodes, n1, n2, n3, nb_threads, reps, cbx, cby, cbz): def deploySUBP(n1, n2, n3, nb_threads, reps, cbx, cby, cbz):
"""Launch MPI execution based on exe file in bin/, and returns average fitness """Launch MPI execution based on exe file in bin/, and returns average fitness
Args: Args:
nb_nodes (int): Number of Kyle nodes to launch the mpirun on.
n1 (int): First dimension of matrix. n1 (int): First dimension of matrix.
n2 (int): Second dimension of matrix. n2 (int): Second dimension of matrix.
n3 (int): Third dimension of matrix. n3 (int): Third dimension of matrix.
...@@ -30,9 +29,6 @@ def deploySUBP(nb_nodes, n1, n2, n3, nb_threads, reps, cbx, cby, cbz): ...@@ -30,9 +29,6 @@ def deploySUBP(nb_nodes, n1, n2, n3, nb_threads, reps, cbx, cby, cbz):
# Get the name of the exe file # Get the name of the exe file
exeFile = os.listdir("bin/")[0] exeFile = os.listdir("bin/")[0]
# according to the deployment rules
print(f"NbNodes: {nb_nodes}, cbx : {cbx}, cby : {cby}, cbz : {cbz}")
# MPI command # MPI command
res = subprocess.run(" bin/" + exeFile + " " + res = subprocess.run(" bin/" + exeFile + " " +
str(n1) + " " + str(n2) + " " + str(n3) + " " + str(n1) + " " + str(n2) + " " + str(n3) + " " +
...@@ -85,9 +81,8 @@ def compileSUBP(optimization, simd): ...@@ -85,9 +81,8 @@ def compileSUBP(optimization, simd):
if __name__ == "__main__": if __name__ == "__main__":
# Command line parsing: # Command line parsing:
nb_nodes, n1, n2, n3, nb_threads, reps, cbx, cby, cbz = tools.cmdLineParsing() n1, n2, n3, nb_threads, reps, cbx, cby, cbz = tools.cmdLineParsing()
print("Number of nodes : " + str(nb_nodes))
print("n1, n2, n3 : " + str(n1) + " " + str(n2) + " " + str(n3)) print("n1, n2, n3 : " + str(n1) + " " + str(n2) + " " + str(n3))
print("Number of threads : " + str(nb_threads)) print("Number of threads : " + str(nb_threads))
print("Number of reps : " + str(reps)) print("Number of reps : " + str(reps))
...@@ -99,5 +94,5 @@ if __name__ == "__main__": ...@@ -99,5 +94,5 @@ if __name__ == "__main__":
print("---------- Deployment using Subprocess module (default values) ---------") print("---------- Deployment using Subprocess module (default values) ---------")
print(deploySUBP(nb_nodes, n1, n2, n3, nb_threads, reps, cbx, cby, cbz)) print(deploySUBP(n1, n2, n3, nb_threads, reps, cbx, cby, cbz))
print(deploySUBP(nb_nodes, n1, n2, n3, nb_threads, reps, cbx, cby, cbz)) print(deploySUBP(n1, n2, n3, nb_threads, reps, cbx, cby, cbz))
...@@ -5,7 +5,6 @@ import re ...@@ -5,7 +5,6 @@ import re
# Cmd line parsing # Cmd line parsing
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
nb_nodes = 1
n1 = 256 n1 = 256
n2 = 256 n2 = 256
n3 = 256 n3 = 256
...@@ -18,7 +17,6 @@ cbz = 32 ...@@ -18,7 +17,6 @@ cbz = 32
def cmdLineParsing(): def cmdLineParsing():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--N", help="number of nodes", default=nb_nodes, type=int)
parser.add_argument("--n1", help="n1", default=n1, type=int) parser.add_argument("--n1", help="n1", default=n1, type=int)
parser.add_argument("--n2", help="n1", default=n2, type=int) parser.add_argument("--n2", help="n1", default=n2, type=int)
parser.add_argument("--n3", help="n1", default=n3, type=int) parser.add_argument("--n3", help="n1", default=n3, type=int)
...@@ -30,7 +28,7 @@ def cmdLineParsing(): ...@@ -30,7 +28,7 @@ def cmdLineParsing():
args = parser.parse_args() args = parser.parse_args()
return args.N, args.n1, args.n2, args.n3, args.thds, args.reps, args.cbx, args.cby, args.cbz return args.n1, args.n2, args.n3, args.thds, args.reps, args.cbx, args.cby, args.cbz
#----------------------------------------------------------------- #-----------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment