mdtest/src/utilities.h

70 lines
2.7 KiB
C
Raw Normal View History

/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*/
/******************************************************************************\
* *
* Copyright (c) 2003, The Regents of the University of California *
* See the file COPYRIGHT for a complete copyright notice and license. *
* *
\******************************************************************************/
#ifndef _UTILITIES_H
#define _UTILITIES_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <mpi.h>
#include "ior.h"
extern int rank;
extern int rankOffset;
extern int verbose;
extern MPI_Comm testComm;
2018-07-08 15:47:55 +03:00
extern FILE * out_resultfile;
2018-07-08 15:07:32 +03:00
extern enum OutputFormat_t outputFormat; /* format of the output */
2018-07-08 00:39:14 +03:00
/*
* Try using the system's PATH_MAX, which is what realpath and such use.
*/
#define MAX_PATHLEN PATH_MAX
#define ERROR_LOCATION __func__
void* safeMalloc(uint64_t size);
void set_o_direct_flag(int *fd);
ior_dataPacketType_e parsePacketType(char t);
void update_write_memory_pattern(uint64_t item, char * buf, size_t bytes, int rand_seed, int rank, ior_dataPacketType_e dataPacketType);
void generate_memory_pattern(char * buf, size_t bytes, int rand_seed, int rank, ior_dataPacketType_e dataPacketType);
/* check a data buffer, @return 0 if all is correct, otherwise 1 */
int verify_memory_pattern(uint64_t item, char * buffer, size_t bytes, int rand_seed, int pretendRank, ior_dataPacketType_e dataPacketType);
char *CurrentTimeString(void);
int Regex(char *, char *);
void ShowFileSystemSize(char * filename, const struct ior_aiori * backend, void * backend_options);
void DumpBuffer(void *, size_t);
void SetHints (MPI_Info *, char *);
void ShowHints (MPI_Info *);
2018-07-08 15:38:05 +03:00
char *HumanReadable(IOR_offset_t value, int base);
int QueryNodeMapping(MPI_Comm comm, int print_nodemap);
Fix #181. On systems where numTasks is not evenly divisible by 'tasksPerNode' we were seeing some nodes reading multiple files while others read none after reordering. Commonly all nodes have the same number of tasks but there is nothing requiring that to be the case. Imagine having 64 tasks running against 4 nodes which can run 20 tasks each. Here you get three groups of 20 and one group of 4. On this sytem nodes running in the group of 4 were previously getting tasksPerNode of 4 which meant they reordered tasks differently than the nodes which got tasksPerNode of 20. The key to fixing this is ensuring that every node reorders tasks the same way, which means ensuring they all use the same input values. Obviously on systems where the number of tasks per node is inconsistent the reordering will also be inconsistent (some tasks may end up on the same node, or not as far separated as desired, etc.) but at least this way you'll always end up with a 1:1 reordering. - Renamed nodes/nodeCount to numNodes - Renamed tasksPerNode to numTasksOnNode0 - Ensured that numTasksOnNode0 will always have the same value regardless of which node you're on - Removed inconsistently used globals numTasksWorld and tasksPerNode and replaced with per-test params equivalents - Added utility functions for setting these values: - numNodes -> GetNumNodes - numTasks -> GetNumTasks - numTasksOnNode0 -> GetNumNodesOnTask0 - Improved MPI_VERSION < 3 logic for GetNumNodes so it works when numTasks is not evenly divisible by numTasksOnNode0 - Left 'nodes' and 'tasksPerNode' in output alone to not break compatibility - Allowed command-line params to override numTasks, numNodes, and numTasksOnNode0 but default to using the MPI-calculated values
2019-08-31 01:45:03 +03:00
int GetNumNodes(MPI_Comm);
int GetNumTasks(MPI_Comm);
int GetNumTasksOnNode0(MPI_Comm);
void DelaySecs(int delay);
void updateParsedOptions(IOR_param_t * options, options_all_t * global_options);
size_t NodeMemoryStringToBytes(char *size_str);
/* Returns -1, if cannot be read */
int64_t ReadStoneWallingIterations(char * const filename, MPI_Comm com);
void StoreStoneWallingIterations(char * const filename, int64_t count);
void init_clock(MPI_Comm com);
double GetTimeStamp(void);
char * PrintTimestamp(); // TODO remove this function
unsigned long GetProcessorAndCore(int *chip, int *core);
void *aligned_buffer_alloc(size_t size, ior_memory_flags type);
void aligned_buffer_free(void *buf, ior_memory_flags type);
#endif /* !_UTILITIES_H */