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

call ACO in a better way

parent a6f4ed18
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ import compute_tau
import launcher_SUBP
def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3=256,
fancy_strategy='AS', sub_threshold=0.1, sup_threshold=10**9,
nb_threads=8, reps=100):
""" Ant colony optimization of the cache blocking parameters for the execution of
the iso3dfd programm.
......@@ -24,6 +25,9 @@ def ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1=256, n2=256, n3
n1 (int, optional): First dimension of matrix. Defaults to 256.
n2 (int, optional): Second dimension of matrix. Defaults to 256.
n3 (int, optional): Third dimension of matrix. Defaults to 256.
fancy_strategy (string, optional): Strategy used to update tau. Defaults to 'AS'.
sub_threshold (float, optional): Inferior threshold for Min-Max strategy. Defaults to 0.1.
sup_threshold (float, optional): Superior threshold for Min-Max strategy. Defaults to 10**9.
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.
......@@ -94,6 +98,7 @@ if __name__ == "__main__":
n1, n2, n3 = 256, 256, 256
optimization = "-O3"
simd = "avx512"
fancy_strategy = "AS"
if Me == 0 :
# Compiling the code
......@@ -102,9 +107,12 @@ if __name__ == "__main__":
comm.Barrier()
if Me == 0:
path_opti, cost_opti = ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter, n1, n2, n3,
nb_threads, reps)
path_opti, cost_opti = ACO(Me, NbP, comm, alpha, rho, Q, nb_ants, tau_0, n_iter,
n1=n1, n2=n2, n3=n3, fancy_strategy=fancy_strategy,
nb_threads=nb_threads, reps=reps)
print(path_opti)
print(cost_opti)
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=n1, n2=n2, n3=n3, fancy_strategy=fancy_strategy,
nb_threads=nb_threads, reps=reps)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment