-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
8,549 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
public | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
|
||
PROGRAM := bin/easypap | ||
|
||
# Must be the first rule | ||
.PHONY: default | ||
default: $(PROGRAM) | ||
|
||
########## Config Section ########## | ||
|
||
ENABLE_SDL = 1 | ||
ENABLE_MONITORING = 1 | ||
ENABLE_VECTO = 1 | ||
ENABLE_FUT = 1 | ||
ENABLE_MPI = 1 | ||
|
||
#################################### | ||
|
||
ARCH := $(shell uname -s | tr a-z A-Z) | ||
|
||
ifdef ENABLE_SDL | ||
SOURCES := $(wildcard src/*.c) | ||
else | ||
SOURCES := $(filter-out src/gmonitor.c src/graphics.c src/cpustat.c, $(wildcard src/*.c)) | ||
endif | ||
|
||
KERNELS := $(wildcard kernel/c/*.c) | ||
|
||
T_SOURCE := traces/src/trace_common.c traces/src/trace_record.c | ||
|
||
|
||
OBJECTS := $(SOURCES:src/%.c=obj/%.o) | ||
K_OBJECTS := $(KERNELS:kernel/c/%.c=obj/%.o) | ||
T_OBJECTS := $(T_SOURCE:traces/src/%.c=obj/%.o) | ||
|
||
ALL_OBJECTS := $(OBJECTS) $(K_OBJECTS) $(T_OBJECTS) | ||
|
||
DEPENDS := $(SOURCES:src/%.c=deps/%.d) | ||
K_DEPENDS := $(KERNELS:kernel/c/%.c=deps/%.d) | ||
T_DEPENDS := $(T_SOURCE:traces/src/%.c=deps/%.d) | ||
|
||
ALL_DEPENDS := $(DEPENDS) $(K_DEPENDS) $(T_DEPENDS) | ||
|
||
MAKEFILES := Makefile | ||
|
||
CC := gcc | ||
|
||
CFLAGS += -O3 -Wall -Wno-unused-function #-march=native | ||
CFLAGS += -I./include -I./traces/include | ||
LDFLAGS += -lm | ||
|
||
ifeq ($(ARCH),DARWIN) | ||
LDLIBS += -framework OpenGL | ||
else | ||
CFLAGS += -rdynamic | ||
LDFLAGS += -export-dynamic | ||
LDLIBS += -lGL -lpthread -ldl | ||
endif | ||
|
||
# Vectorization | ||
ifdef ENABLE_VECTO | ||
CFLAGS += -DENABLE_VECTO -DVEC_SIZE=8 -mavx2 -mfma | ||
#CFLAGS += -DENABLE_VECTO -DVEC_SIZE=4 -msse4 -mfma | ||
endif | ||
|
||
# Monitoring | ||
ifdef ENABLE_MONITORING | ||
CFLAGS += -DENABLE_MONITORING | ||
endif | ||
|
||
# OpenMP | ||
CFLAGS += -fopenmp | ||
LDFLAGS += -fopenmp | ||
|
||
# OpenCL | ||
CFLAGS += -DCL_SILENCE_DEPRECATION | ||
ifeq ($(ARCH),DARWIN) | ||
LDLIBS += -framework OpenCL | ||
else | ||
LDLIBS += -lOpenCL | ||
endif | ||
|
||
# Hardware Locality | ||
PACKAGES := hwloc | ||
|
||
ifdef ENABLE_SDL | ||
CFLAGS += -DENABLE_SDL | ||
PACKAGES += SDL2_image SDL2_ttf | ||
endif | ||
|
||
ifdef ENABLE_FUT | ||
CFLAGS += -DENABLE_FUT | ||
PACKAGES += fxt | ||
endif | ||
|
||
# MPI | ||
ifdef ENABLE_MPI | ||
CFLAGS += -DENABLE_MPI | ||
PACKAGES += ompi | ||
endif | ||
|
||
|
||
# Query CFLAGS and LDLIBS for all packages | ||
CFLAGS += $(shell pkg-config --cflags $(PACKAGES)) | ||
LDLIBS += $(shell pkg-config --libs $(PACKAGES)) | ||
|
||
$(ALL_OBJECTS): $(MAKEFILES) | ||
|
||
$(PROGRAM): $(ALL_OBJECTS) | ||
$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) | ||
|
||
$(OBJECTS): obj/%.o: src/%.c | ||
$(CC) -o $@ $(CFLAGS) -c $< | ||
|
||
$(K_OBJECTS): obj/%.o: kernel/c/%.c | ||
$(CC) -o $@ $(CFLAGS) -c $< | ||
|
||
$(T_OBJECTS): obj/%.o: traces/src/%.c | ||
$(CC) -o $@ $(CFLAGS) -c $< | ||
|
||
|
||
.PHONY: depend | ||
depend: $(ALL_DEPENDS) | ||
|
||
$(ALL_DEPENDS): $(MAKEFILES) | ||
|
||
$(DEPENDS): deps/%.d: src/%.c | ||
$(CC) $(CFLAGS) -MM $< | \ | ||
sed -e 's|\(.*\)\.o:|deps/\1.d obj/\1.o:|g' > $@ | ||
|
||
$(K_DEPENDS): deps/%.d: kernel/c/%.c | ||
$(CC) $(CFLAGS) -MM $< | \ | ||
sed -e 's|\(.*\)\.o:|deps/\1.d obj/\1.o:|g' > $@ | ||
|
||
$(T_DEPENDS): deps/%.d: traces/src/%.c | ||
$(CC) $(CFLAGS) -MM $< | \ | ||
sed -e 's|\(.*\)\.o:|deps/\1.d obj/\1.o:|g' > $@ | ||
|
||
|
||
ifneq ($(MAKECMDGOALS),clean) | ||
-include $(ALL_DEPENDS) | ||
endif | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f $(PROGRAM) obj/*.o deps/*.d lib/*.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
# EasyPAP Student Edition | ||
This projects aims at providing students with an easy-to-use programming environment to learn parallel programming. | ||
|
||
The idea is to parallelize sequential computations on 2D matrices over multicore and GPU platforms. At each iteration, | ||
the current matrix can be displayed, allowing to visually check the correctness of the computation method. | ||
|
||
Multiple variants can easily been developed (e.g. sequential, tiled, omp_for, omp_task, ocl, mpi) and compared. | ||
|
||
Most of the parameters can be specified as command line arguments, when running the program : | ||
* size of the 2D matrices or image file to be loaded | ||
* kernel to use (e.g. pixellize) | ||
* variant to use (e.g. omp_task) | ||
* maximum number of iterations to perform | ||
* interactive mode / performance mode | ||
* monitoring mode | ||
* and much more! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
#ifndef CONSTANTS_IS_DEF | ||
#define CONSTANTS_IS_DEF | ||
|
||
#define DEFAULT_DIM 1024 | ||
#define DEFAULT_KERNEL "none" | ||
#define DEFAULT_VARIANT "seq" | ||
#define DEFAULT_OCL_VARIANT "ocl" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef CPUSTAT_IS_DEF | ||
#define CPUSTAT_IS_DEF | ||
|
||
#ifdef ENABLE_SDL | ||
|
||
#include <SDL.h> | ||
|
||
static void cpustat_create_cpu_textures (void); | ||
static void unsigned_to_sdl_color (unsigned color, SDL_Color *sdlc); | ||
static void cpustat_create_text_texture (void); | ||
static void cpustat_draw_text (void); | ||
static void cpustat_draw_perfmeters (void); | ||
|
||
void cpustat_init (int x, int y); | ||
void cpustat_reset (long now); | ||
void cpustat_start_work (long now, int who); | ||
void cpustat_finish_work (long now, int who); | ||
void cpustat_start_idle (long now, int who); | ||
void cpustat_freeze (long now); | ||
void cpustat_display_stats (void); | ||
void cpustat_clean (void); | ||
|
||
int cpustat_tile (int who); | ||
|
||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
#ifndef DEBUG_IS_DEF | ||
#define DEBUG_IS_DEF | ||
|
||
// La fonction PRINT_DEBUG permet d'afficher selectivement certains messages | ||
// de debug. Le choix du type des messages s'effectue au moyen d'une | ||
// chaine contenant des filtres. Ces filtres sont : | ||
// | ||
// '+' -- active tous les messages de debug | ||
// 'g' -- graphics | ||
// 'c' -- computations | ||
// 's' -- scheduler | ||
// 't' -- threads | ||
// 'o' -- OpenCL | ||
// 'm' -- monitoring | ||
// 'i' -- initialization sequence | ||
// 'u' -- user | ||
// 'M' -- MPI | ||
|
||
#include <stdarg.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
void debug_init (char *flags); | ||
int debug_enabled (char flag); | ||
|
||
extern char *debug_flags; | ||
|
||
extern unsigned easypap_mpirun; | ||
|
||
#define PRINT_DEBUG(flag, format, ...) \ | ||
do { \ | ||
if (debug_flags != NULL && debug_enabled (flag)) { \ | ||
if (easypap_mpirun) \ | ||
fprintf (stderr, "Proc %d: " format, easypap_mpi_rank (), \ | ||
##__VA_ARGS__); \ | ||
else \ | ||
fprintf (stderr, format, ##__VA_ARGS__); \ | ||
} \ | ||
} while (0) | ||
|
||
#define PRINT_MASTER(format, ...) \ | ||
do { \ | ||
if (!easypap_mpirun || easypap_mpi_rank () == 0) \ | ||
fprintf (stderr, format, ##__VA_ARGS__); \ | ||
} while (0) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef EASYPAP_IS_DEF | ||
#define EASYPAP_IS_DEF | ||
|
||
|
||
#include "global.h" | ||
#include "debug.h" | ||
#include "error.h" | ||
#include "monitoring.h" | ||
#include "ocl.h" | ||
#include "pthread_barrier.h" | ||
#include "scheduler.h" | ||
#include "minmax.h" | ||
|
||
#ifdef ENABLE_MPI | ||
#include <mpi.h> | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#ifndef ERROR_IS_DEF | ||
#define ERROR_IS_DEF | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <sys/errno.h> | ||
|
||
#ifdef THIS_FILE | ||
#define __THIS_FILE__ THIS_FILE | ||
#else | ||
#define __THIS_FILE__ __FILE__ | ||
#endif | ||
|
||
#define exit_with_error(format, ...) \ | ||
do { \ | ||
fprintf (stderr, "%s:%d: Error: " format "\n", __THIS_FILE__, __LINE__, \ | ||
##__VA_ARGS__); \ | ||
exit (EXIT_FAILURE); \ | ||
} while (0) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
#ifndef GLOBAL_IS_DEF | ||
#define GLOBAL_IS_DEF | ||
|
||
#include "hooks.h" | ||
#include "img_data.h" | ||
|
||
extern unsigned do_display; | ||
extern unsigned vsync; | ||
extern unsigned refresh_rate; | ||
extern unsigned do_first_touch; | ||
extern int max_iter; | ||
extern char *easypap_image_file; | ||
extern char *draw_param; | ||
|
||
extern unsigned opencl_used; | ||
extern unsigned easypap_mpirun; | ||
|
||
|
||
extern char *kernel_name, *variant_name; | ||
|
||
unsigned easypap_requested_number_of_threads (void); | ||
unsigned easypap_number_of_cores (void); | ||
int easypap_mpi_rank (void); | ||
int easypap_mpi_size (void); | ||
void easypap_check_mpi (void); | ||
int easypap_proc_is_master (void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifndef GMONITOR_IS_DEF | ||
#define GMONITOR_IS_DEF | ||
|
||
#ifdef ENABLE_SDL | ||
|
||
void gmonitor_init (int x, int y); | ||
void gmonitor_clean (); | ||
|
||
void __gmonitor_start_iteration (long time); | ||
void __gmonitor_end_iteration (long time); | ||
void __gmonitor_start_tile (long time, int who); | ||
void __gmonitor_end_tile (long time, int who, int x, int y, int width, | ||
int height); | ||
|
||
|
||
#define gmonitor_start_iteration(t) \ | ||
do { \ | ||
if (do_gmonitor) \ | ||
__gmonitor_start_iteration (t); \ | ||
} while (0) | ||
|
||
#define gmonitor_end_iteration(t) \ | ||
do { \ | ||
if (do_gmonitor) \ | ||
__gmonitor_end_iteration (t); \ | ||
} while (0) | ||
|
||
#define gmonitor_start_tile(t, c) \ | ||
do { \ | ||
if (do_gmonitor) \ | ||
__gmonitor_start_tile ((t), (c)); \ | ||
} while (0) | ||
|
||
#define gmonitor_end_tile(t, c, x, y, w, h) \ | ||
do { \ | ||
if (do_gmonitor) \ | ||
__gmonitor_end_tile ((t), (c), (x), (y), (w), (h)); \ | ||
} while (0) | ||
|
||
|
||
extern unsigned do_gmonitor; | ||
|
||
|
||
#endif | ||
|
||
#endif |
Oops, something went wrong.