IOR
Macros | Functions | Variables
ior.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <mpi.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <assert.h>
#include "ior.h"
#include "ior-internal.h"
#include "aiori.h"
#include "utilities.h"
#include "parse_options.h"
Include dependency graph for ior.c:

Go to the source code of this file.

Macros

#define IOR_NB_TIMERS   6
 

Functions

static void DestroyTests (IOR_test_t *tests_head)
 
static char * PrependDir (IOR_param_t *, char *)
 
static char ** ParseFileName (char *, int *)
 
static void InitTests (IOR_test_t *)
 
static void TestIoSys (IOR_test_t *)
 
static void ValidateTests (IOR_param_t *params, MPI_Comm com)
 
static IOR_offset_t WriteOrRead (IOR_param_t *test, IOR_results_t *results, aiori_fd_t *fd, const int access, IOR_io_buffers *ioBuffers)
 
static void ior_set_xfer_hints (IOR_param_t *p)
 
static int test_initialize (IOR_test_t *test)
 
static void test_finalize (IOR_test_t *test)
 
IOR_test_tior_run (int argc, char **argv, MPI_Comm world_com, FILE *world_out)
 
int ior_main (int argc, char **argv)
 
void init_IOR_Param_t (IOR_param_t *p, MPI_Comm com)
 
static void DisplayOutliers (int numTasks, double timerVal, char *timeString, int access, int outlierThreshold)
 
static void CheckForOutliers (IOR_param_t *test, const double *timer, const int access)
 
static void CheckFileSize (IOR_test_t *test, char *testFilename, IOR_offset_t dataMoved, int rep, const int access)
 
static size_t CompareData (void *expectedBuffer, size_t size, IOR_offset_t transferCount, IOR_param_t *test, IOR_offset_t offset, int fillrank, int access)
 
static int CountErrors (IOR_param_t *test, int access, int errors)
 
void AllocResults (IOR_test_t *test)
 
void FreeResults (IOR_test_t *test)
 
IOR_test_tCreateTest (IOR_param_t *init_params, int test_num)
 
static void DestroyTest (IOR_test_t *test)
 
static void DistributeHints (MPI_Comm com)
 
static void FillIncompressibleBuffer (void *buffer, IOR_param_t *test)
 
static void FillBuffer (void *buffer, IOR_param_t *test, unsigned long long offset, int fillrank)
 
char * GetPlatformName ()
 
void GetTestFileName (char *testFileName, IOR_param_t *test)
 
static void ReduceIterResults (IOR_test_t *test, double *timer, const int rep, const int access)
 
static void RemoveFile (char *testFileName, int filePerProc, IOR_param_t *test)
 
static void XferBuffersSetup (IOR_io_buffers *ioBuffers, IOR_param_t *test, int pretendRank)
 
static void XferBuffersFree (IOR_io_buffers *ioBuffers, IOR_param_t *test)
 
static void * malloc_and_touch (size_t size)
 
static void file_hits_histogram (IOR_param_t *params)
 
int test_time_elapsed (IOR_param_t *params, double startTime)
 
static void * HogMemory (IOR_param_t *params)
 
static void WriteTimes (IOR_param_t *test, const double *timer, const int iteration, const int access)
 
static void StoreRankInformation (IOR_test_t *test, double *timer, const int rep, const int access)
 
static void ProcessIterResults (IOR_test_t *test, double *timer, const int rep, const int access)
 
IOR_offset_tGetOffsetArrayRandom (IOR_param_t *test, int pretendRank, IOR_offset_t *out_count)
 
static IOR_offset_t WriteOrReadSingle (IOR_offset_t offset, int pretendRank, IOR_offset_t transfer, IOR_offset_t *transferCount, int *errors, IOR_param_t *test, aiori_fd_t *fd, IOR_io_buffers *ioBuffers, int access)
 
static void prefillSegment (IOR_param_t *test, void *randomPrefillBuffer, int pretendRank, aiori_fd_t *fd, IOR_io_buffers *ioBuffers, int startSegment, int endSegment)
 

Variables

char ** environ
 
static int totalErrorCount
 
static const ior_aiori_tbackend
 
int aiori_warning_as_errors = 0
 
static unsigned int reseed_incompressible_prng = TRUE
 

Macro Definition Documentation

◆ IOR_NB_TIMERS

#define IOR_NB_TIMERS   6

Definition at line 48 of file ior.c.

Referenced by ReduceIterResults(), TestIoSys(), and WriteTimes().

Function Documentation

◆ AllocResults()

void AllocResults ( IOR_test_t test)

Definition at line 521 of file ior.c.

References NULL, IOR_test_t::params, IOR_param_t::repetitions, IOR_test_t::results, and safeMalloc().

Referenced by ParseCommandLine(), and ReadConfigScript().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckFileSize()

static void CheckFileSize ( IOR_test_t test,
char *  testFilename,
IOR_offset_t  dataMoved,
int  rep,
const int  access 
)
static

◆ CheckForOutliers()

static void CheckForOutliers ( IOR_param_t test,
const double *  timer,
const int  access 
)
static

Definition at line 326 of file ior.c.

References DisplayOutliers(), IOR_param_t::numTasks, and IOR_param_t::outlierThreshold.

Referenced by ProcessIterResults().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CompareData()

static size_t CompareData ( void *  expectedBuffer,
size_t  size,
IOR_offset_t  transferCount,
IOR_param_t test,
IOR_offset_t  offset,
int  fillrank,
int  access 
)
static

◆ CountErrors()

static int CountErrors ( IOR_param_t test,
int  access,
int  errors 
)
static

Definition at line 492 of file ior.c.

References IOR_param_t::checkRead, IOR_param_t::checkWrite, IOR_param_t::errorFound, EWARNF, MPI_CHECK, out_logfile, rank, testComm, IOR_param_t::timeStampSignatureValue, totalErrorCount, TRUE, WARN, and WRITECHECK.

Referenced by WriteOrRead().

Here is the caller graph for this function:

◆ CreateTest()

IOR_test_t* CreateTest ( IOR_param_t init_params,
int  test_num 
)

Create new test for list of tests.

Definition at line 542 of file ior.c.

References ERR, GetPlatformName(), IOR_param_t::id, IOR_test_t::next, NULL, IOR_test_t::params, IOR_param_t::platform, and IOR_test_t::results.

Referenced by ParseCommandLine(), and ReadConfigScript().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DestroyTest()

static void DestroyTest ( IOR_test_t test)
static

Definition at line 558 of file ior.c.

References FreeResults().

Referenced by DestroyTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DestroyTests()

static void DestroyTests ( IOR_test_t tests_head)
static

Definition at line 564 of file ior.c.

References DestroyTest(), IOR_test_t::next, and NULL.

Referenced by ior_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisplayOutliers()

static void DisplayOutliers ( int  numTasks,
double  timerVal,
char *  timeString,
int  access,
int  outlierThreshold 
)
static

Definition at line 285 of file ior.c.

References EWARNF, MAX_STR, results::mean, MPI_CHECK, numTasks, rank, results::sd, results::sum, testComm, results::var, and WRITE.

Referenced by CheckForOutliers().

Here is the caller graph for this function:

◆ DistributeHints()

static void DistributeHints ( MPI_Comm  com)
static

Definition at line 577 of file ior.c.

References environ, MAX_HINTS, MAX_STR, MPI_CHECK, NULL, rank, and WARN.

Referenced by InitTests().

Here is the caller graph for this function:

◆ file_hits_histogram()

static void file_hits_histogram ( IOR_param_t params)
static

Definition at line 1068 of file ior.c.

References MPI_CHECK, NULL, numTasks, IOR_param_t::numTasks, out_logfile, rank, rankOffset, and IOR_param_t::testComm.

Referenced by TestIoSys().

Here is the caller graph for this function:

◆ FillBuffer()

static void FillBuffer ( void *  buffer,
IOR_param_t test,
unsigned long long  offset,
int  fillrank 
)
static

Definition at line 644 of file ior.c.

References IOR_param_t::dataPacketType, FillIncompressibleBuffer(), incompressible, IOR_param_t::timeStampSignatureValue, and IOR_param_t::transferSize.

Referenced by TestIoSys(), and WriteOrReadSingle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FillIncompressibleBuffer()

static void FillIncompressibleBuffer ( void *  buffer,
IOR_param_t test 
)
static

Definition at line 623 of file ior.c.

References FALSE, IOR_param_t::incompressibleSeed, rank, reseed_incompressible_prng, IOR_param_t::setTimeStampSignature, IOR_param_t::transferSize, and TRUE.

Referenced by FillBuffer().

Here is the caller graph for this function:

◆ FreeResults()

void FreeResults ( IOR_test_t test)

Definition at line 531 of file ior.c.

References NULL, and IOR_test_t::results.

Referenced by DestroyTest().

Here is the caller graph for this function:

◆ GetOffsetArrayRandom()

IOR_offset_t* GetOffsetArrayRandom ( IOR_param_t test,
int  pretendRank,
IOR_offset_t out_count 
)

Returns a precomputed array of IOR_offset_t for the inner benchmark loop. They get created sequentially and mixed up in the end. It should be noted that as the seeds get synchronised across all processes if not FilePerProcess is set every process computes the same random order. For a shared file all transfers get randomly assigned to ranks. The processes can also have differen't numbers of transfers. This might lead to a bigger diversion in accesse as it dose with filePerProc. This is expected but should be mined.

Parameters
testIOR_param_t for getting transferSize, blocksize and SegmentCount
pretendRankint pretended Rank for shifting the offsets correctly
Returns
IOR_offset_t

Definition at line 1679 of file ior.c.

References IOR_param_t::blockSize, IOR_param_t::filePerProc, MPI_CHECK, NULL, IOR_param_t::numTasks, IOR_param_t::randomSeed, rank, safeMalloc(), IOR_param_t::testComm, and IOR_param_t::transferSize.

Referenced by WriteOrRead().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPlatformName()

char* GetPlatformName ( void  )

Definition at line 671 of file ior.c.

References EWARN, and MAX_STR.

Referenced by CreateTest(), and ParseCommandLine().

Here is the caller graph for this function:

◆ GetTestFileName()

void GetTestFileName ( char *  testFileName,
IOR_param_t test 
)

◆ HogMemory()

static void* HogMemory ( IOR_param_t params)
static

Definition at line 1128 of file ior.c.

References ERR, malloc_and_touch(), IOR_param_t::memoryPerNode, IOR_param_t::memoryPerTask, NULL, IOR_param_t::numTasksOnNode0, out_logfile, verbose, and VERBOSE_3.

Referenced by TestIoSys().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_IOR_Param_t()

void init_IOR_Param_t ( IOR_param_t p,
MPI_Comm  com 
)

◆ InitTests()

static void InitTests ( IOR_test_t tests)
static

◆ ior_main()

int ior_main ( int  argc,
char **  argv 
)

Definition at line 183 of file ior.c.

References DestroyTests(), InitTests(), MPI_CHECK, IOR_test_t::next, NULL, out_logfile, out_resultfile, ParseCommandLine(), PrintHeader(), PrintLongSummaryAllTests(), PrintTestEnds(), rank, ShowTestEnd(), test_finalize(), test_initialize(), TestIoSys(), totalErrorCount, verbose, VERBOSE_0, VERBOSE_1, and VERBOSE_4.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ior_run()

IOR_test_t* ior_run ( int  argc,
char **  argv,
MPI_Comm  world_com,
FILE *  world_out 
)

◆ ior_set_xfer_hints()

static void ior_set_xfer_hints ( IOR_param_t p)
static

◆ malloc_and_touch()

static void* malloc_and_touch ( size_t  size)
static

Definition at line 1046 of file ior.c.

References NULL.

Referenced by HogMemory().

Here is the caller graph for this function:

◆ ParseFileName()

static char ** ParseFileName ( char *  name,
int *  count 
)
static

Definition at line 715 of file ior.c.

References ERR, FILENAME_DELIMITER, and NULL.

Referenced by GetTestFileName().

Here is the caller graph for this function:

◆ prefillSegment()

static void prefillSegment ( IOR_param_t test,
void *  randomPrefillBuffer,
int  pretendRank,
aiori_fd_t fd,
IOR_io_buffers ioBuffers,
int  startSegment,
int  endSegment 
)
static

Definition at line 1800 of file ior.c.

References IOR_param_t::blockSize, IO_BUFFERS::buffer, IOR_param_t::filePerProc, IOR_param_t::numTasks, offset, IOR_param_t::randomPrefillBlocksize, WRITE, and WriteOrReadSingle().

Referenced by WriteOrRead().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrependDir()

static char * PrependDir ( IOR_param_t test,
char *  rootDir 
)
static

Definition at line 811 of file ior.c.

References ior_aiori::access, IOR_param_t::backend_options, ERR, ERRF, MAX_STR, ior_aiori::mkdir, NULL, IOR_param_t::numTasks, rank, and rankOffset.

Referenced by GetTestFileName().

Here is the caller graph for this function:

◆ ProcessIterResults()

static void ProcessIterResults ( IOR_test_t test,
double *  timer,
const int  rep,
const int  access 
)
static

Definition at line 1253 of file ior.c.

References CheckForOutliers(), IOR_param_t::outlierThreshold, IOR_test_t::params, ReduceIterResults(), IOR_param_t::saveRankDetailsCSV, StoreRankInformation(), verbose, VERBOSE_3, and WriteTimes().

Referenced by TestIoSys().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReduceIterResults()

static void ReduceIterResults ( IOR_test_t test,
double *  timer,
const int  rep,
const int  access 
)
static

◆ RemoveFile()

static void RemoveFile ( char *  testFileName,
int  filePerProc,
IOR_param_t test 
)
static

Definition at line 925 of file ior.c.

References ior_aiori::access, IOR_param_t::backend_options, ior_aiori::delete, GetTestFileName(), out_logfile, rank, rankOffset, IOR_param_t::reorderTasksRandom, TRUE, verbose, and VERBOSE_3.

Referenced by TestIoSys().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StoreRankInformation()

static void StoreRankInformation ( IOR_test_t test,
double *  timer,
const int  rep,
const int  access 
)
static

◆ test_finalize()

static void test_finalize ( IOR_test_t test)
static

Definition at line 139 of file ior.c.

References IOR_param_t::backend, IOR_param_t::backend_options, ior_aiori::finalize, MPI_CHECK, IOR_param_t::mpi_comm_world, IOR_test_t::params, and testComm.

Referenced by ior_main(), and ior_run().

Here is the caller graph for this function:

◆ test_initialize()

static int test_initialize ( IOR_test_t test)
static

◆ test_time_elapsed()

int test_time_elapsed ( IOR_param_t params,
double  startTime 
)

Definition at line 1113 of file ior.c.

References GetTimeStamp(), and IOR_param_t::maxTimeDuration.

Referenced by TestIoSys().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TestIoSys()

static void TestIoSys ( IOR_test_t test)
static

Definition at line 1271 of file ior.c.

References IOR_param_t::backend_options, IO_BUFFERS::buffer, CheckFileSize(), IOR_param_t::checkRead, IOR_param_t::checkWrite, ior_aiori::close, ior_aiori::create, CurrentTimeString(), IOR_param_t::deadlineForStonewalling, DelaySecs(), ERR, IOR_param_t::errorFound, EWARNF, FAIL, FALSE, file_hits_histogram(), aiori_xfer_hint_t::filePerProc, IOR_param_t::filePerProc, FillBuffer(), GetTestFileName(), GetTimeStamp(), IOR_param_t::hints, HogMemory(), IOR_param_t::interTestDelay, IOR_param_t::intraTestBarriers, IOR_CREAT, IOR_NB_TIMERS, IOR_RDONLY, IOR_TRUNC, IOR_WRONLY, IOR_param_t::keepFile, IOR_param_t::keepFileWithError, MAX_STR, MPI_CHECK, IOR_param_t::multiFile, NULL, IOR_param_t::numNodes, IOR_param_t::numTasks, IOR_param_t::numTasksOnNode0, ior_aiori::open, IOR_param_t::open, out_logfile, IOR_point_t::pairs_accessed, IOR_test_t::params, PrintLongSummaryHeader(), PrintLongSummaryOneTest(), PrintRemoveTiming(), PrintRepeatEnd(), PrintShortSummary(), PrintTableHeader(), ProcessIterResults(), rank, rankOffset, READ, READCHECK, IOR_param_t::readFile, ReadStoneWallingIterations(), RemoveFile(), IOR_param_t::reorderTasks, IOR_param_t::reorderTasksRandom, IOR_param_t::reorderTasksRandomSeed, IOR_param_t::repCounter, IOR_param_t::repetitions, reseed_incompressible_prng, IOR_test_t::results, IOR_param_t::setTimeStampSignature, ShowSetup(), ior_aiori::stat, IOR_param_t::stoneWallingStatusFile, IOR_param_t::stoneWallingWearOutIterations, IOR_param_t::summary_every_test, IOR_param_t::taskPerNodeOffset, IOR_param_t::tasksBlockMapping, test_time_elapsed(), testComm, IOR_param_t::testComm, IOR_param_t::timeStampSignatureValue, TRUE, IOR_param_t::useExistingTestFile, verbose, IOR_param_t::verbose, VERBOSE_0, VERBOSE_1, VERBOSE_2, VERBOSE_3, VERBOSE_4, WARN, WRITE, IOR_results_t::write, WRITECHECK, IOR_param_t::writeFile, WriteOrRead(), XferBuffersFree(), and XferBuffersSetup().

Referenced by ior_main(), and ior_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidateTests()

static void ValidateTests ( IOR_param_t params,
MPI_Comm  com 
)
static

◆ WriteOrRead()

static IOR_offset_t WriteOrRead ( IOR_param_t test,
IOR_results_t results,
aiori_fd_t fd,
const int  access,
IOR_io_buffers ioBuffers 
)
static

◆ WriteOrReadSingle()

static IOR_offset_t WriteOrReadSingle ( IOR_offset_t  offset,
int  pretendRank,
IOR_offset_t  transfer,
IOR_offset_t transferCount,
int *  errors,
IOR_param_t test,
aiori_fd_t fd,
IOR_io_buffers ioBuffers,
int  access 
)
static

Definition at line 1755 of file ior.c.

References IOR_param_t::backend_options, IO_BUFFERS::buffer, CompareData(), ERR, FillBuffer(), ior_aiori::fsync, IOR_param_t::fsyncPerWrite, IOR_param_t::interIODelay, NULL, READ, READCHECK, IOR_param_t::storeFileOffset, TRUE, WRITE, WRITECHECK, and ior_aiori::xfer.

Referenced by prefillSegment(), and WriteOrRead().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteTimes()

static void WriteTimes ( IOR_param_t test,
const double *  timer,
const int  iteration,
const int  access 
)
static

Definition at line 1157 of file ior.c.

References IOR_param_t::id, IOR_NB_TIMERS, MAX_STR, out_logfile, rank, and WRITE.

Referenced by ProcessIterResults().

Here is the caller graph for this function:

◆ XferBuffersFree()

static void XferBuffersFree ( IOR_io_buffers ioBuffers,
IOR_param_t test 
)
static

Definition at line 1035 of file ior.c.

References aligned_buffer_free(), IO_BUFFERS::buffer, and IOR_param_t::gpuMemoryFlags.

Referenced by TestIoSys().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ XferBuffersSetup()

static void XferBuffersSetup ( IOR_io_buffers ioBuffers,
IOR_param_t test,
int  pretendRank 
)
static

Definition at line 1026 of file ior.c.

References aligned_buffer_alloc(), IO_BUFFERS::buffer, IOR_param_t::gpuMemoryFlags, and IOR_param_t::transferSize.

Referenced by TestIoSys().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ aiori_warning_as_errors

int aiori_warning_as_errors = 0

Definition at line 85 of file ior.c.

Referenced by InitTests(), mdtest_run(), and test_initialize().

◆ backend

const ior_aiori_t* backend
static

Definition at line 53 of file ior.c.

Referenced by updateParsedOptions().

◆ environ

char** environ

Referenced by DistributeHints().

◆ reseed_incompressible_prng

unsigned int reseed_incompressible_prng = TRUE
static

Definition at line 620 of file ior.c.

Referenced by FillIncompressibleBuffer(), and TestIoSys().

◆ totalErrorCount

int totalErrorCount
static

Definition at line 52 of file ior.c.

Referenced by CountErrors(), ior_main(), ior_run(), and WriteOrRead().