Fix heat MPI benchmarks

This commit is contained in:
Rodrigo Arias 2023-06-23 16:58:18 +02:00
parent 802eeca3ee
commit 18ab6b6a14
8 changed files with 65 additions and 16 deletions

View File

@ -10,7 +10,8 @@ endmacro()
macro(mk_heat_mpi_nanos6 NAME SOURCE) macro(mk_heat_mpi_nanos6 NAME SOURCE)
mk_heat_mpi(${NAME} ${SOURCE}) mk_heat_mpi(${NAME} ${SOURCE})
target_link_libraries(${NAME} PRIVATE Nanos6::wrapper) target_compile_options(${NAME} PRIVATE "-fompss-2=libnanos6")
target_link_options(${NAME} PRIVATE "-fompss-2=libnanos6")
endmacro() endmacro()
macro(mk_heat_mpi_nodes NAME SOURCE) macro(mk_heat_mpi_nodes NAME SOURCE)
@ -18,6 +19,12 @@ macro(mk_heat_mpi_nodes NAME SOURCE)
target_link_libraries(${NAME} PRIVATE Nodes::wrapper) target_link_libraries(${NAME} PRIVATE Nodes::wrapper)
endmacro() endmacro()
macro(mk_heat_tampi_nanos6 NAME SOURCE)
mk_heat_mpi_nanos6(${NAME} ${SOURCE})
target_link_libraries(${NAME} PRIVATE Tampi::tampi-c)
endmacro()
# ------------------------------------------------------------------- # -------------------------------------------------------------------
add_library(heat_mpi_common STATIC main.c utils.c) add_library(heat_mpi_common STATIC main.c utils.c)
@ -35,3 +42,7 @@ if(NODES_FOUND)
mk_heat_mpi_nodes(b6_heat_mpi_nodes_forkjoin solver_mpi_ompss2_forkjoin.c) mk_heat_mpi_nodes(b6_heat_mpi_nodes_forkjoin solver_mpi_ompss2_forkjoin.c)
mk_heat_mpi_nodes(b6_heat_mpi_nodes_tasks solver_mpi_ompss2_tasks.c) mk_heat_mpi_nodes(b6_heat_mpi_nodes_tasks solver_mpi_ompss2_tasks.c)
endif() endif()
if(NANOS6_FOUND AND TAMPI_FOUND)
mk_heat_tampi_nanos6(b6_heat_itampi_nanos6_tasks solver_itampi_ompss2_tasks.c)
endif()

View File

@ -1,4 +1,5 @@
#include <mpi.h> #include <mpi.h>
#include <math.h>
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -19,16 +20,7 @@ void generateImage(const HeatConfiguration *conf, int64_t rows, int64_t cols, in
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
#if defined(TAMPI) const int required = mpi_level();
// TAMPI+OmpSs-2 variants
const int required = MPI_TASK_MULTIPLE;
#elif defined(_OMPSS_2)
// MPI+OmpSs-2 variants
const int required = MPI_THREAD_SERIALIZED;
#else
// MPI-only variants
const int required = MPI_THREAD_SINGLE;
#endif
int provided; int provided;
MPI_Init_thread(&argc, &argv, required, &provided); MPI_Init_thread(&argc, &argv, required, &provided);
@ -76,8 +68,10 @@ int main(int argc, char **argv)
if (!rank) { if (!rank) {
int64_t totalElements = conf.rows*conf.cols; int64_t totalElements = conf.rows*conf.cols;
//double time_element = (end-start)/(totalElements*conf.timesteps);
double throughput = (totalElements*conf.timesteps)/(end-start); double throughput = (totalElements*conf.timesteps)/(end-start);
throughput = throughput/1000000.0; //throughput = throughput/1000000.0;
double residual = NAN;
#ifdef _OMPSS_2 #ifdef _OMPSS_2
int threads = nanos6_get_num_cpus(); int threads = nanos6_get_num_cpus();
@ -85,10 +79,17 @@ int main(int argc, char **argv)
int threads = 1; int threads = 1;
#endif #endif
fprintf(stdout, "rows, %ld, cols, %ld, rows/rank, %ld, total, %ld, total/rank, %ld, rbs, %d, " fprintf(stderr, "%14s %14s %14s %8s %8s %8s %8s %8s %8s\n",
"cbs, %d, ranks, %d, threads, %d, timesteps, %d, time, %f, Mupdates/s, %f\n", "throughput", "time", "error",
conf.rows, conf.cols, conf.rows/nranks, totalElements, totalElements/nranks, "rows", "cols",
conf.rbs, conf.cbs, nranks, threads, conf.timesteps, end-start, throughput); "rbs", "cbs", "threads",
"steps");
fprintf(stdout, "%14e %14e %14e %8ld %8ld %8d %8d %8d %8d\n",
throughput, end-start, residual,
conf.rows, conf.cols,
conf.rbs, conf.cbs, threads,
conf.convergenceTimesteps);
} }
if (conf.generateImage) { if (conf.generateImage) {

View File

@ -4,6 +4,17 @@
#include "utils.h" #include "utils.h"
#include "common/heat.h" #include "common/heat.h"
const char *
summary(void)
{
return "Parallel version using MPI + OmpSs-2 tasks + Non-blocking TAMPI";
}
int
mpi_level(void)
{
return MPI_TASK_MULTIPLE;
}
static inline void send(const double *data, int nelems, int dst, int tag) static inline void send(const double *data, int nelems, int dst, int tag)
{ {
@ -55,6 +66,7 @@ static inline void gaussSeidelSolver(int64_t rows, int64_t cols, int rbs, int cb
double solve(HeatConfiguration *conf, int64_t rows, int64_t cols, int timesteps, void *extraData) double solve(HeatConfiguration *conf, int64_t rows, int64_t cols, int timesteps, void *extraData)
{ {
(void) extraData;
double (*matrix)[cols] = (double (*)[cols]) conf->matrix; double (*matrix)[cols] = (double (*)[cols]) conf->matrix;
const int rbs = conf->rbs; const int rbs = conf->rbs;
const int cbs = conf->cbs; const int cbs = conf->cbs;

View File

@ -3,6 +3,12 @@
#include "utils.h" #include "utils.h"
#include "common/heat.h" #include "common/heat.h"
int
mpi_level(void)
{
return MPI_THREAD_SINGLE;
}
const char * const char *
summary(void) summary(void)
{ {

View File

@ -8,6 +8,12 @@ typedef struct {
MPI_Request recv; MPI_Request recv;
} HaloRequests; } HaloRequests;
int
mpi_level(void)
{
return MPI_THREAD_SINGLE;
}
const char * const char *
summary(void) summary(void)
{ {

View File

@ -3,6 +3,12 @@
#include "utils.h" #include "utils.h"
#include "common/heat.h" #include "common/heat.h"
int
mpi_level(void)
{
return MPI_THREAD_SERIALIZED;
}
const char * const char *
summary(void) summary(void)
{ {

View File

@ -5,6 +5,12 @@
static int serial; static int serial;
int
mpi_level(void)
{
return MPI_THREAD_SERIALIZED;
}
const char * const char *
summary(void) summary(void)
{ {

View File

@ -17,5 +17,6 @@ typedef struct {
void broadcastConfiguration(HeatConfiguration *configuration); void broadcastConfiguration(HeatConfiguration *configuration);
void initializeWindows(HeatConfiguration *configuration, int64_t rows, int64_t cols, MPIRMAInfo *info); void initializeWindows(HeatConfiguration *configuration, int64_t rows, int64_t cols, MPIRMAInfo *info);
void finalizeWindows(MPIRMAInfo *info); void finalizeWindows(MPIRMAInfo *info);
int mpi_level(void);
#endif // MPI_UTILS_H #endif // MPI_UTILS_H