Fix heat MPI benchmarks
This commit is contained in:
parent
802eeca3ee
commit
18ab6b6a14
@ -10,7 +10,8 @@ endmacro()
|
||||
|
||||
macro(mk_heat_mpi_nanos6 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()
|
||||
|
||||
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)
|
||||
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)
|
||||
@ -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_tasks solver_mpi_ompss2_tasks.c)
|
||||
endif()
|
||||
|
||||
if(NANOS6_FOUND AND TAMPI_FOUND)
|
||||
mk_heat_tampi_nanos6(b6_heat_itampi_nanos6_tasks solver_itampi_ompss2_tasks.c)
|
||||
endif()
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <mpi.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.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)
|
||||
{
|
||||
#if defined(TAMPI)
|
||||
// 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
|
||||
const int required = mpi_level();
|
||||
|
||||
int provided;
|
||||
MPI_Init_thread(&argc, &argv, required, &provided);
|
||||
@ -76,8 +68,10 @@ int main(int argc, char **argv)
|
||||
|
||||
if (!rank) {
|
||||
int64_t totalElements = conf.rows*conf.cols;
|
||||
//double time_element = (end-start)/(totalElements*conf.timesteps);
|
||||
double throughput = (totalElements*conf.timesteps)/(end-start);
|
||||
throughput = throughput/1000000.0;
|
||||
//throughput = throughput/1000000.0;
|
||||
double residual = NAN;
|
||||
|
||||
#ifdef _OMPSS_2
|
||||
int threads = nanos6_get_num_cpus();
|
||||
@ -85,10 +79,17 @@ int main(int argc, char **argv)
|
||||
int threads = 1;
|
||||
#endif
|
||||
|
||||
fprintf(stdout, "rows, %ld, cols, %ld, rows/rank, %ld, total, %ld, total/rank, %ld, rbs, %d, "
|
||||
"cbs, %d, ranks, %d, threads, %d, timesteps, %d, time, %f, Mupdates/s, %f\n",
|
||||
conf.rows, conf.cols, conf.rows/nranks, totalElements, totalElements/nranks,
|
||||
conf.rbs, conf.cbs, nranks, threads, conf.timesteps, end-start, throughput);
|
||||
fprintf(stderr, "%14s %14s %14s %8s %8s %8s %8s %8s %8s\n",
|
||||
"throughput", "time", "error",
|
||||
"rows", "cols",
|
||||
"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) {
|
||||
|
@ -4,6 +4,17 @@
|
||||
#include "utils.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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
(void) extraData;
|
||||
double (*matrix)[cols] = (double (*)[cols]) conf->matrix;
|
||||
const int rbs = conf->rbs;
|
||||
const int cbs = conf->cbs;
|
||||
|
@ -3,6 +3,12 @@
|
||||
#include "utils.h"
|
||||
#include "common/heat.h"
|
||||
|
||||
int
|
||||
mpi_level(void)
|
||||
{
|
||||
return MPI_THREAD_SINGLE;
|
||||
}
|
||||
|
||||
const char *
|
||||
summary(void)
|
||||
{
|
||||
|
@ -8,6 +8,12 @@ typedef struct {
|
||||
MPI_Request recv;
|
||||
} HaloRequests;
|
||||
|
||||
int
|
||||
mpi_level(void)
|
||||
{
|
||||
return MPI_THREAD_SINGLE;
|
||||
}
|
||||
|
||||
const char *
|
||||
summary(void)
|
||||
{
|
||||
|
@ -3,6 +3,12 @@
|
||||
#include "utils.h"
|
||||
#include "common/heat.h"
|
||||
|
||||
int
|
||||
mpi_level(void)
|
||||
{
|
||||
return MPI_THREAD_SERIALIZED;
|
||||
}
|
||||
|
||||
const char *
|
||||
summary(void)
|
||||
{
|
||||
|
@ -5,6 +5,12 @@
|
||||
|
||||
static int serial;
|
||||
|
||||
int
|
||||
mpi_level(void)
|
||||
{
|
||||
return MPI_THREAD_SERIALIZED;
|
||||
}
|
||||
|
||||
const char *
|
||||
summary(void)
|
||||
{
|
||||
|
@ -17,5 +17,6 @@ typedef struct {
|
||||
void broadcastConfiguration(HeatConfiguration *configuration);
|
||||
void initializeWindows(HeatConfiguration *configuration, int64_t rows, int64_t cols, MPIRMAInfo *info);
|
||||
void finalizeWindows(MPIRMAInfo *info);
|
||||
int mpi_level(void);
|
||||
|
||||
#endif // MPI_UTILS_H
|
||||
|
Loading…
Reference in New Issue
Block a user