Skip to content

Commit 4146aae

Browse files
committed
Added baseline algorithm with no multi-processing
1 parent 5979020 commit 4146aae

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ SHELL = /bin/zsh
44
# Multiprocessing library name (MPI or OMP)
55
whichmp?=MPI
66

7+
CC_NONE = gcc
8+
CFLAGS_NONE = -g -O3 -Wall -D__MP_NONE__
9+
710
# Compiler settings (OpenMP)
811
CC_OMP = gcc
912
CFLAGS_OMP = -g -O3 -Wall -fopenmp
@@ -20,6 +23,11 @@ CFLAGS = $(CFLAGS_$(whichmp))
2023
SRC_DIR = src/$(whichmp)
2124
OBJ_DIR = obj/$(whichmp)
2225

26+
# Use OMP sources if NONE is selected
27+
ifeq ($(whichmp),NONE)
28+
SRC_DIR = src/OMP
29+
endif
30+
2331
# Source and compiled objects
2432
SRCS = $(wildcard $(SRC_DIR)/*.c)
2533
OBJS = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRCS))
@@ -65,6 +73,7 @@ arguments_medpub = --docs 106330 \
6573
--threshold 0.3 \
6674
".datasets/medpub"
6775

76+
RUN_NONE = ./$(EXEC) -n 1 $(arguments_$(dataset))
6877
RUN_OMP = ./$(EXEC) -n $(processes) $(arguments_$(dataset))
6978
RUN_MPI = mpiexec -n $(processes) --oversubscribe ./$(EXEC) $(arguments_$(dataset))
7079

@@ -112,7 +121,9 @@ report: exists-dataset
112121
export TIMEFMT="$(dataset),$(whichmp),$$i,%E,%U,%S,%P" ; \
113122
echo "Running on $(whichmp) with $$i processes" ; \
114123
\
115-
if [[ "$(whichmp)" == "OMP" ]]; then \
124+
if [[ "$(whichmp)" == "NONE" ]]; then \
125+
{ time ./$(EXEC) -n 1 $(arguments_$(dataset)) 2> /dev/null ; } 2>> $(TIME_FILE) ; \
126+
elif [[ "$(whichmp)" == "OMP" ]]; then \
116127
{ time ./$(EXEC) -n $$i $(arguments_$(dataset)) 2> /dev/null ; } 2>> $(TIME_FILE) ; \
117128
elif [[ "$(whichmp)" == "MPI" ]]; then \
118129
{ time mpiexec -n $$i --oversubscribe ./$(EXEC) $(arguments_$(dataset)) 2> /dev/null ; } 2>> $(TIME_FILE) ; \

src/OMP/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#ifndef __MP_NONE__
12
#include <omp.h>
3+
#endif
24

35
#include "main.h"
46
#include "io_interface.h"
@@ -9,6 +11,9 @@ int main(int argc, char *argv[]) {
911
// Read arguments and share among all processes
1012
struct Arguments args = input_arguments(argc, (const char **) argv);
1113

14+
// Ignore OpenMP instructions if compiling explicitly without multi-processing
15+
#ifndef __MP_NONE__
16+
1217
// Set desired number of threads
1318
omp_set_dynamic(0);
1419
omp_set_num_threads(args.proc.comm_sz);
@@ -24,6 +29,8 @@ int main(int argc, char *argv[]) {
2429
return 7;
2530
}
2631

32+
#endif
33+
2734
// Start the MinHash algorithm
2835
mh_main(args);
2936

0 commit comments

Comments
 (0)