1 #ifndef __UTILS_SYSTEM_H__
2 #define __UTILS_SYSTEM_H__
11 #define MPI_UINT64 MPI_UNSIGNED_LONG
12 #define MPI_INT64 MPI_LONG
21 #if _OPENMP < 201107 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9 && !defined(__INTEL_COMPILER) && !defined(__clang__))
22 #error MP-Gadget requires OpenMP >= 3.1. Use a newer compiler (gcc >= 4.9, intel >= 16 clang >= 5).
26 void catch_abort(
int sig);
27 void catch_fatal(
int sig);
28 void enable_core_dumps_and_fpu_exceptions(
void);
39 void sumup_longs(
int n, int64_t *src, int64_t *res);
44 int MPIU_Any(
int condition, MPI_Comm comm);
57 MPI_Datatype sendtype,
void *recvbuf,
int *recvcnts,
58 int *rdispls, MPI_Datatype recvtype, MPI_Comm comm);
61 MPI_Datatype sendtype,
void *recvbuf,
int *recvcnts,
62 int *rdispls, MPI_Datatype recvtype, MPI_Comm comm);
64 double timediff(
double t0,
double t1);
66 size_t sizemax(
size_t a,
size_t b);
70 #pragma omp atomic capture
80 #pragma omp atomic capture
89 #pragma omp atomic capture
97 void MPIU_Trace(MPI_Comm comm,
int where,
const char * fmt, ...);
98 void MPIU_Tracev(MPI_Comm comm,
int where,
int error,
const char * fmt, va_list va);
100 int _MPIU_Barrier(
const char * fn,
const int ln, MPI_Comm comm);
103 #define MPIU_Barrier(comm) _MPIU_Barrier(__FILE__, __LINE__, comm)
107 int MPI_Allreduce_Checked(
const void *sendbuf,
void *recvbuf,
int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm,
const int line,
const char * file);
108 int MPI_Reduce_Checked(
const void *sendbuf,
void *recvbuf,
int count, MPI_Datatype datatype, MPI_Op op,
int root, MPI_Comm comm,
const int line,
const char * file);
110 #ifndef __UTILS_SYSTEM_C
111 #define MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm) \
112 MPI_Allreduce_Checked(sendbuf, recvbuf, count, datatype, op, comm, __LINE__, __FILE__)
113 #define MPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm) \
114 MPI_Reduce_Checked(sendbuf, recvbuf, count, datatype, op, root, comm, __LINE__, __FILE__)
void gadget_setup_thread_arrays(int *dest, int *srcs[], size_t sizes[], size_t total_size, int narrays)
static int atomic_fetch_and_add(int *ptr, int value)
int MPI_Alltoallv_sparse(void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype sendtype, void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype recvtype, MPI_Comm comm)
double get_random_number(uint64_t id)
int64_t count_sum(int64_t countLocal)
double get_physmem_bytes(void)
void sumup_longs(int n, int64_t *src, int64_t *res)
void MPIU_Tracev(MPI_Comm comm, int where, int error, const char *fmt, va_list va)
int cluster_get_num_hosts(void)
void MPIU_write_pids(char *filename)
int MPI_Alltoallv_smart(void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype sendtype, void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype recvtype, MPI_Comm comm)
void MPIU_Trace(MPI_Comm comm, int where, const char *fmt,...)
static int atomic_add_and_fetch(int *ptr, int value)
size_t sizemax(size_t a, size_t b)
void sumup_large_ints(int n, int *src, int64_t *res)
double timediff(double t0, double t1)
void set_random_numbers(int seed)
size_t gadget_compact_thread_arrays(int *dest, int *srcs[], size_t sizes[], int narrays)
int _MPIU_Barrier(const char *fn, const int ln, MPI_Comm comm)
static int64_t atomic_fetch_and_add_64(int64_t *ptr, int64_t value)
int MPIU_Any(int condition, MPI_Comm comm)