NeoPZ
Classes | Macros | Functions | Variables
gflopstest.cpp File Reference

Measure the amount of GFlops/s the system can sustain. More...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
#include "arglib.h"
#include "run_stats_table.h"
Include dependency graph for gflopstest.cpp:

Go to the source code of this file.

Classes

struct  thread_arg_t
 
struct  thread_map1_arg< T >
 

Macros

#define MIN_T(a, b)
 
#define GIGA
 
#define VERBOSE(level, ...)
 
#define MEGABYTE
 

Functions

void help (const char *prg)
 
void clean_mem (unsigned sz)
 
void process_arr (double *ara, double *arb, double *arc, unsigned sz, unsigned nthreads, void *(*fun)(void *))
 
template<class T >
void * thread_map1_worker (void *arg)
 
template<class T >
void thread_map1 (T *array, T(*map1)(T), unsigned sz, unsigned nthreads)
 
void mul_arr_rev (double *ara, double *arb, double *arc, unsigned sz, unsigned threads)
 
double sqrt_dbl (double v)
 
void * mul_arr (void *a)
 
void * imul_arr (void *a)
 
void * add_arr (void *a)
 
void * acc_arr (void *a)
 
void * mulred_arr (void *a)
 
void * mulsingle_arr (void *a)
 
void profile (double *ara, double *arb, double *arc, unsigned sz, unsigned num_threads, void *(*fun)(void *), ElapsedTimeRunStat &et, RunStatsTable &rst)
 
double gflops (ElapsedTimeRunStat &et, unsigned sz)
 
int main (int argc, char *argv[])
 

Variables

clarg::argInt asz ("-asz", "array size", 10000000)
 
clarg::argInt moda ("-moda", "modulo a", 0)
 
clarg::argInt modb ("-modb", "modulo b", 0)
 
clarg::argInt modc ("-modc", "modulo c", 0)
 
clarg::argInt nt ("-nt", "number of threads", 0)
 
clarg::argInt verb_level ("-v", "verbosity level", 0)
 
clarg::argBool h ("-h", "help message", false)
 
clarg::argInt cm ("-cm", "clean memory before execution", 512)
 
RunStatsTable mul_rst ("-mul_rdt", "Array multiply statistics raw data table")
 
RunStatsTable imul_rst ("-imul_rdt", "Array immeditate multiply statistics raw data table")
 
RunStatsTable mulred_rst ("-mulred_rdt", "Array multiply and reduce statistics raw data table")
 
RunStatsTable add_rst ("-add_rdt", "Array add statistics raw data table")
 
RunStatsTable acc_rst ("-acc_rdt", "Array accumulate statistics raw data table")
 
RunStatsTable mulsingle_rst ("-mulsingle_rdt", "Fake array-multiply statistics raw data table")
 
double global_res
 

Detailed Description

Measure the amount of GFlops/s the system can sustain.

Author
Edson Borin
Since
2012

Definition in file gflopstest.cpp.

Macro Definition Documentation

◆ GIGA

#define GIGA

Referenced by gflops().

◆ MEGABYTE

#define MEGABYTE

Referenced by main().

◆ MIN_T

#define MIN_T (   a,
 
)

Referenced by process_arr(), and thread_map1().

◆ VERBOSE

#define VERBOSE (   level,
  ... 
)

Function Documentation

◆ acc_arr()

void* acc_arr ( void *  a)

Definition at line 196 of file gflopstest.cpp.

References thread_arg_t::ara, thread_arg_t::arb, and thread_arg_t::sz.

Referenced by main().

◆ add_arr()

void* add_arr ( void *  a)

Definition at line 183 of file gflopstest.cpp.

References thread_arg_t::ara, thread_arg_t::arb, thread_arg_t::arc, and thread_arg_t::sz.

Referenced by main().

◆ clean_mem()

void clean_mem ( unsigned  sz)

Definition at line 44 of file gflopstest.cpp.

References acc_rst, add_rst, imul_rst, mul_rst, mulred_rst, and mulsingle_rst.

Referenced by main().

◆ gflops()

double gflops ( ElapsedTimeRunStat et,
unsigned  sz 
)

Definition at line 248 of file gflopstest.cpp.

References ElapsedTimeRunStat::getElapsedMS(), and GIGA.

Referenced by main().

◆ help()

void help ( const char *  prg)

Definition at line 23 of file gflopstest.cpp.

References clarg::arguments_descriptions(), asz, cm, h, moda, modb, modc, nt, and verb_level.

Referenced by main().

◆ imul_arr()

void* imul_arr ( void *  a)

Definition at line 171 of file gflopstest.cpp.

References thread_arg_t::ara, and thread_arg_t::sz.

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ mul_arr()

void* mul_arr ( void *  a)

Definition at line 158 of file gflopstest.cpp.

References thread_arg_t::ara, thread_arg_t::arb, thread_arg_t::arc, and thread_arg_t::sz.

Referenced by main().

◆ mul_arr_rev()

void mul_arr_rev ( double *  ara,
double *  arb,
double *  arc,
unsigned  sz,
unsigned  threads 
)

Definition at line 149 of file gflopstest.cpp.

◆ mulred_arr()

void* mulred_arr ( void *  a)

Definition at line 209 of file gflopstest.cpp.

References thread_arg_t::arb, thread_arg_t::arc, test::res, and thread_arg_t::sz.

Referenced by main().

◆ mulsingle_arr()

void* mulsingle_arr ( void *  a)

Definition at line 223 of file gflopstest.cpp.

References thread_arg_t::arb, thread_arg_t::arc, test::res, and thread_arg_t::sz.

Referenced by main().

◆ process_arr()

void process_arr ( double *  ara,
double *  arb,
double *  arc,
unsigned  sz,
unsigned  nthreads,
void *(*)(void *)  fun 
)

Definition at line 68 of file gflopstest.cpp.

References thread_arg_t::ara, thread_arg_t::arb, thread_arg_t::arc, MIN_T, nthreads, and thread_arg_t::sz.

Referenced by profile().

◆ profile()

void profile ( double *  ara,
double *  arb,
double *  arc,
unsigned  sz,
unsigned  num_threads,
void *(*)(void *)  fun,
ElapsedTimeRunStat et,
RunStatsTable rst 
)

◆ sqrt_dbl()

double sqrt_dbl ( double  v)

Definition at line 156 of file gflopstest.cpp.

◆ thread_map1()

template<class T >
void thread_map1 ( T *  array,
T(*)(T)  map1,
unsigned  sz,
unsigned  nthreads 
)

◆ thread_map1_worker()

template<class T >
void* thread_map1_worker ( void *  arg)

Variable Documentation

◆ acc_rst

RunStatsTable acc_rst("-acc_rdt", "Array accumulate statistics raw data table")

Referenced by clean_mem(), and main().

◆ add_rst

RunStatsTable add_rst("-add_rdt", "Array add statistics raw data table")

Referenced by clean_mem(), and main().

◆ asz

clarg::argInt asz("-asz", "array size", 10000000)

Referenced by help().

◆ cm

clarg::argInt cm("-cm", "clean memory before execution", 512)

Referenced by help().

◆ global_res

double global_res

Definition at line 208 of file gflopstest.cpp.

◆ h

clarg::argBool h("-h", "help message", false)

Referenced by help().

◆ imul_rst

RunStatsTable imul_rst("-imul_rdt", "Array immeditate multiply statistics raw data table")

Referenced by clean_mem(), and main().

◆ moda

clarg::argInt moda("-moda", "modulo a", 0)

Referenced by help().

◆ modb

clarg::argInt modb("-modb", "modulo b", 0)

Referenced by help().

◆ modc

clarg::argInt modc("-modc", "modulo c", 0)

Referenced by help().

◆ mul_rst

RunStatsTable mul_rst("-mul_rdt", "Array multiply statistics raw data table")

Referenced by clean_mem(), and main().

◆ mulred_rst

RunStatsTable mulred_rst("-mulred_rdt", "Array multiply and reduce statistics raw data table")

Referenced by clean_mem(), and main().

◆ mulsingle_rst

RunStatsTable mulsingle_rst("-mulsingle_rdt", "Fake array-multiply statistics raw data table")

Referenced by clean_mem(), and main().

◆ nt

clarg::argInt nt("-nt", "number of threads", 0)

Referenced by help().

◆ verb_level

clarg::argInt verb_level("-v", "verbosity level", 0)

Referenced by help().