Skip to content

Commit 3c13866

Browse files
committed
add IMB-RMA-GPU
1 parent fbf6498 commit 3c13866

File tree

9 files changed

+89
-5
lines changed

9 files changed

+89
-5
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,22 @@ IMB-MPI1-GPU:
6868
make -C src_cpp -f Makefile TARGET=MPI1 GPU_ENABLE=1
6969
@cp src_cpp/IMB-MPI1 ./IMB-MPI1-GPU
7070

71+
IMB-RMA-GPU:
72+
make -C src_cpp -f Makefile TARGET=RMA GPU_ENABLE=1
73+
@cp src_cpp/IMB-RMA ./IMB-RMA-GPU
74+
7175

7276
clean:
7377
make -C src_cpp -f Makefile TARGET=MPI1 clean
78+
make -C src_cpp -f Makefile TARGET=MPI1 clean GPU_ENABLE=1
7479
make -C src_cpp -f Makefile TARGET=NBC clean
7580
make -C src_cpp -f Makefile TARGET=RMA clean
81+
make -C src_cpp -f Makefile TARGET=RMA clean GPU_ENABLE=1
7682
make -C src_cpp -f Makefile TARGET=EXT clean
7783
make -C src_cpp -f Makefile TARGET=IO clean
7884
make -C src_cpp -f Makefile TARGET=MT clean
7985
make -C src_c/P2P -f Makefile TARGET=P2P clean
80-
make -C src_cpp -f Makefile TARGET=MPI1 clean GPU_ENABLE=1
8186
rm -f IMB-MPI1 IMB-NBC IMB-RMA IMB-EXT IMB-IO IMB-MT IMB-P2P
8287
if [ -e IMB-MPI1-GPU ]; then rm -f IMB-MPI1-GPU; fi
88+
if [ -e IMB-RMA-GPU ]; then rm -f IMB-RMA-GPU; fi
8389
if [ -e IMB-MPI4 ]; then make -C src_cpp -f Makefile TARGET=MPI4 clean; rm -f IMB-MPI4; fi

src_c/IMB_bnames_rma.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ char *DEFC[] = {
6262
"Exchange_get",
6363
"Accumulate",
6464
"Get_accumulate",
65+
#ifndef GPU_ENABLE
6566
"Fetch_and_op",
6667
"Compare_and_swap",
68+
#endif //!GPU_ENABLE
6769
"Truly_passive_put"
6870
};
6971

@@ -88,7 +90,9 @@ char *ALLC[] = {
8890
"Exchange_get",
8991
"Accumulate",
9092
"Get_accumulate",
93+
#ifndef GPU_ENABLE
9194
"Fetch_and_op",
9295
"Compare_and_swap",
96+
#endif //!GPU_ENABLE
9397
"Truly_passive_put"
9498
};

src_c/IMB_g_info.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ void IMB_general_info() {
9898
#elif defined NBC
9999
fprintf(unit, "# Intel(R) MPI Benchmarks %s, MPI-NBC part\n", VERSION);
100100
#elif defined RMA
101+
#ifdef GPU_ENABLE
102+
fprintf(unit, "# Intel(R) MPI Benchmarks %s, RMA part (GPU), Technical preview\n", VERSION);
103+
#else
101104
fprintf(unit, "# Intel(R) MPI Benchmarks %s, MPI-RMA part\n", VERSION);
105+
#endif //GPU_ENABLE
102106
#elif defined MPI4
103107
fprintf(unit, "# Intel(R) MPI Benchmarks %s, MPI-4 part\n", VERSION);
104108
#endif

src_c/IMB_mem_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ For more documentation than found here, see
7070
#include <limits.h> /* for INT_MAX declaration*/
7171
#include <stdint.h>
7272

73-
#if defined(GPU_ENABLE) && defined(MPI1)
73+
#if defined(GPU_ENABLE) && (defined(MPI1) || defined(RMA))
7474
#include "IMB_gpu_common.h"
7575
#define IMB_ALLOC(buff, size, where) \
7676
do { \

src_c/IMB_output.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,8 +1323,10 @@ void IMB_help()
13231323
"Exchange_get\n"
13241324
"Accumulate\n"
13251325
"Get_accumulate\n"
1326+
#ifndef GPU_ENABLE
13261327
"Fetch_and_op\n"
13271328
"Compare_and_swap\n"
1329+
#endif //!GPU_ENABLE
13281330
"Truly_passive_put\n"
13291331
"\n");
13301332

src_c/IMB_parse_name_rma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ void IMB_set_bmark(struct Bench* bmark) {
193193
type = SingleTransfer;
194194
bmark->access = put;
195195
bmark->reduction = 1;
196+
#ifndef GPU_ENABLE
196197
} else if (!strcmp(bmark->name, "fetch_and_op")) {
197198
bmark->Benchmark = IMB_rma_fetch_and_op;
198199
type = SingleElementTransfer;
@@ -203,6 +204,7 @@ void IMB_set_bmark(struct Bench* bmark) {
203204
type = SingleElementTransfer;
204205
bmark->access = put;
205206
bmark->bench_comments = Compare_and_swap_cmt;
207+
#endif //!GPU_ENABLE
206208
} else if (!strcmp(bmark->name, "truly_passive_put")) {
207209
bmark->Benchmark = IMB_rma_passive_put;
208210
type = SingleTransfer;

src_cpp/RMA/Makefile.RMA.mk

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,42 @@ $(C_SRC_DIR)/IMB_rma_put.c \
5353
$(C_SRC_DIR)/IMB_cpu_exploit.c \
5454
$(C_SRC_DIR)/IMB_rma_get.c \
5555
$(C_SRC_DIR)/IMB_rma_atomic.c
56-
C_OBJ=$(subst $(C_SRC_DIR),RMA,$(C_SRC:.c=.o))
56+
ifdef GPU_ENABLE
57+
override C_SRC += $(C_SRC_DIR)/IMB_gpu_common.c
58+
override CPPFLAGS += -DGPU_ENABLE
59+
override LDFLAGS += -ldl
60+
ifdef CUDA_INCLUDE_DIR
61+
override C_SRC += $(C_SRC_DIR)/IMB_cuda.c \
62+
$(C_SRC_DIR)/IMB_cuda_api.c
63+
override CPPFLAGS += -I${CUDA_INCLUDE_DIR} -DCUDA_INCLUDE_DIR
64+
endif
65+
ifdef ZE_INCLUDE_DIR
66+
override C_SRC += $(C_SRC_DIR)/IMB_ze.c \
67+
$(C_SRC_DIR)/IMB_ze_api.c
68+
override CPPFLAGS += -I${ZE_INCLUDE_DIR} -DZE_INCLUDE_DIR
69+
endif
70+
ifndef CUDA_INCLUDE_DIR
71+
ifndef ZE_INCLUDE_DIR
72+
ifneq (clean, $(filter clean,$(MAKECMDGOALS)))
73+
$(error CUDA_INCLUDE_DIR and ZE_INCLUDE_DIR are not set)
74+
endif
75+
endif
76+
endif
77+
SUBDIR:=GPU
78+
else
79+
SUBDIR:=CPU
80+
endif
81+
82+
C_OBJ=$(subst $(C_SRC_DIR),RMA/$(SUBDIR),$(C_SRC:.c=.o))
5783
ADDITIONAL_OBJ += $(C_OBJ)
84+
BECHMARK_SUITE_LOCAL_OBJ=$(subst RMA/,RMA/$(SUBDIR)/,$(BECHMARK_SUITE_LOCAL_SRC:.cpp=.o))
85+
ADDITIONAL_OBJ += $(BECHMARK_SUITE_LOCAL_OBJ)
5886

59-
RMA/%.o: $(C_SRC_DIR)/%.c
87+
RMA/$(SUBDIR)/%.o: $(C_SRC_DIR)/%.c $(SUBDIR)
6088
$(CC) $(CFLAGS) $(CPPFLAGS) -DRMA -c -o $@ $<
89+
90+
RMA/$(SUBDIR)/%.o: RMA/%.cpp $(SUBDIR)
91+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -DRMA -c -o $@ $<
92+
93+
${SUBDIR}:
94+
mkdir -p RMA/${SUBDIR}

src_cpp/RMA/RMA_benchmark.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ BENCHMARK(IMB_rma_get_accumulate, Get_accumulate)
259259
return true;
260260
}
261261

262+
#ifndef GPU_ENABLE
262263
BENCHMARK(IMB_rma_fetch_and_op, Fetch_and_op)
263264
{
264265
descr->flags.insert(DEFAULT);
@@ -280,6 +281,7 @@ BENCHMARK(IMB_rma_compare_and_swap, Compare_and_swap)
280281
descr->comments.push_back("Uses MPI_INT data type");
281282
return true;
282283
}
284+
#endif //!GPU_ENABLE
283285

284286
BENCHMARK(IMB_rma_passive_put, Truly_passive_put)
285287
{

src_cpp/RMA/RMA_suite.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,19 @@ template <> bool BenchmarkSuite<BS_RMA>::declare_args(args_parser &parser, std::
325325
"\n"
326326
"Default:\n"
327327
"off\n");
328+
#ifdef GPU_ENABLE
329+
parser.add<string>("mem_alloc_type", "device").set_caption("buffer type").
330+
set_description(
331+
"The argument after -mem_alloc_type is a one from possible strings,\n"
332+
"Specifying that type will be used:\n"
333+
"device, host, shared, cpu\n"
334+
"\n"
335+
"Example:\n"
336+
"-mem_alloc_type host\n"
337+
"\n"
338+
"Default:\n"
339+
"device\n");
340+
#endif //GPU_ENABLE
328341
parser.set_default_current_group();
329342
return true;
330343
}
@@ -502,7 +515,24 @@ template <> bool BenchmarkSuite<BS_RMA>::prepare(const args_parser &parser, cons
502515
if (parser.get<bool>("msg_pause") == true) {
503516
c_info.msg_pause = 1;
504517
}
505-
518+
519+
#ifdef GPU_ENABLE
520+
gpu_initialize();
521+
// mem_alloc_type
522+
string mem_alloc_type = parser.get<string>("mem_alloc_type");
523+
if (mem_alloc_type == "cpu") {
524+
c_info.mem_alloc_type = MAT_CPU;
525+
}
526+
else if (mem_alloc_type == "device") {
527+
c_info.mem_alloc_type = MAT_DEVICE;
528+
}
529+
else if (mem_alloc_type == "host") {
530+
c_info.mem_alloc_type = MAT_HOST;
531+
}
532+
else if (mem_alloc_type == "shared") {
533+
c_info.mem_alloc_type = MAT_SHARED;
534+
}
535+
#endif //GPU_ENABLE
506536
#endif
507537

508538
#if BASIC_INPUT_EXPERIMENT == 0

0 commit comments

Comments
 (0)