Skip to content

Commit

Permalink
Added some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
pjdevs committed May 25, 2022
1 parent 136c809 commit c4a2887
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 344 deletions.
31 changes: 31 additions & 0 deletions kernel/c/life.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,37 @@ unsigned life_compute_omp_tiled (unsigned nb_iter)
return res;
}

// One parallel section with barrier and single (a little bit less efficient)
unsigned life_compute_omp_tiled_barrier (unsigned nb_iter)
{
unsigned res = 0, change = 0, temp = 0;

#pragma omp parallel shared(change) private(temp)
for (unsigned it = 1; it <= nb_iter; it++) {
change = 0;
temp = 0;

#pragma omp for schedule(runtime) collapse(2)
for (int y = 0; y < DIM; y += TILE_H)
{
for (int x = 0; x < DIM; x += TILE_W)
{
temp = do_tile (x, y, TILE_W, TILE_H, omp_get_thread_num());

#pragma omp critical
change |= temp;
}
}

#pragma omp barrier

#pragma omp single
swap_tables ();
}

return res;
}

unsigned tiles_around_changed(int x, int y)
{
if (last_changed_table(y, x))
Expand Down
Binary file removed plot.pdf
Binary file not shown.
Binary file added plot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plot_ocl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion plots/easyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
# Creation du graphe :
fig = easyPlotDataFrame(df=df, args=args)

savePlotAsPDF(fig)
# savePlotAsPDF(fig)
savePlotAsPNG(fig)
5 changes: 4 additions & 1 deletion plots/graphTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def openfile(path="./plots/data/perf_data.csv", sepa=";"):
print("File not found: ", path, file=sys.stderr)
sys.exit(1)

# Donne tous les champs de df qui ne sont pas listés
# Donne tous les champs de df qui ne sont pas list�s


def complementaryCols(listeAttr, df):
Expand Down Expand Up @@ -485,3 +485,6 @@ def savePlotAsPDF(fig):
pp = PdfPages(args.output)
plt.savefig(pp, format='pdf')
pp.close()

def savePlotAsPNG(fig):
plt.savefig(args.output, format='png')
24 changes: 12 additions & 12 deletions plots/run-xp-life.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@
# Dictionnaire avec les options de compilations d'apres commande
options = {}
options["-k "] = ["life"]
options["-i "] = [30]
options["-v "] = ["omp", "omp_task"]
options["-s "] = [1024, 2048]
options["-g "] = [4, 8, 16, 32]
options["-a "] = ["random"]

# Pour renseigner l'option '-of' il faut donner le chemin depuis le fichier easypap
options["-of "] = ["./plots/data/perf_data.csv"]

options["-i "] = [500]
options["-v "] = ["omp_tiled", "omp_tiled_lazy"]
options["-s "] = [1024]
options["-ts "] = [8, 16, 32]
options["-a "] = ["guns"]
options["-of "] = ["./plots/data/life.csv"]

# Dictionnaire avec les options OMP
ompenv = {}
ompenv["OMP_NUM_THREADS="] = [1] + list(range(2, 9, 2))
ompenv["OMP_PLACES="] = ["cores", "threads"]
ompenv["OMP_NUM_THREADS="] = [2, 4, 8]
# ompenv["OMP_PLACES="] = ["cores", "threads"]

nbrun = 4

# Lancement des experiences
execute('./run ', ompenv, options, nbrun, verbose=True, easyPath=".")

# Lancement de la version seq avec le nombre de thread impose a 1
options["-v "] = ["seq"]
options["-v "] = ["tiled"]
del options["-ts "]
ompenv["OMP_NUM_THREADS="] = [1]

execute('./run', ompenv, options, nbrun, verbose=False, easyPath=".")
41 changes: 41 additions & 0 deletions plots/run-xp-life_ocl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3

from graphTools import *
from expTools import *
import os

# Dictionnaire avec les options de compilations d'apres commande
options = {}
options["-k "] = ["life"]
options["-i "] = [500]
options["-v "] = ["omp_tiled"]
options["-s "] = [2176]
options["-ts "] = [8, 16, 32]
options["-a "] = ["octa_off"]
options["-of "] = ["./plots/data/life_seq.csv"]

# Dictionnaire avec les options OMP
ompenv = {}
ompenv["OMP_NUM_THREADS="] = [4]
# ompenv["OMP_PLACES="] = ["cores", "threads"]

nbrun = 4

# Lancement des experiences
# execute('./run ', ompenv, options, nbrun, verbose=False, easyPath=".")

# Lancement de la version ocl
options["-v "] = ["ocl"]
options["-o "] = [""]
ompenv = {}

# execute('./run', ompenv, options, nbrun, verbose=False, easyPath=".")

# Lancement de la version seq avec le nombre de thread impose a 1
options["-v "] = ["tiled"]
del options["-ts "]
del options["-o "]
ompenv["OMP_NUM_THREADS="] = [1]

execute('./run', ompenv, options, nbrun, verbose=False, easyPath=".")

112 changes: 0 additions & 112 deletions rotation.csv

This file was deleted.

Loading

0 comments on commit c4a2887

Please sign in to comment.