Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature aiori #184

Merged
merged 5 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/aiori-DUMMY.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ static int DUMMY_stat (const char *path, struct stat *buf, IOR_param_t * param){
return 0;
}

static int DUMMY_check_params(IOR_param_t * test){
return 1;
}

ior_aiori_t dummy_aiori = {
.name = "DUMMY",
.name_legacy = NULL,
Expand All @@ -163,4 +167,5 @@ ior_aiori_t dummy_aiori = {
.finalize = NULL,
.get_options = DUMMY_options,
.enable_mdtest = true,
.check_params = DUMMY_check_params
};
12 changes: 12 additions & 0 deletions src/aiori-POSIX.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
static IOR_offset_t POSIX_Xfer(int, void *, IOR_size_t *,
IOR_offset_t, IOR_param_t *);
static void POSIX_Fsync(void *, IOR_param_t *);
static void POSIX_Sync(IOR_param_t * );

/************************** O P T I O N S *****************************/
typedef struct{
Expand Down Expand Up @@ -122,6 +123,7 @@ ior_aiori_t posix_aiori = {
.stat = aiori_posix_stat,
.get_options = POSIX_options,
.enable_mdtest = true,
.sync = POSIX_Sync
};

/***************************** F U N C T I O N S ******************************/
Expand Down Expand Up @@ -588,6 +590,16 @@ static void POSIX_Fsync(void *fd, IOR_param_t * param)
EWARNF("fsync(%d) failed", *(int *)fd);
}


static void POSIX_Sync(IOR_param_t * param)
{
int ret = system("sync");
if (ret != 0){
FAIL("Error executing the sync command, ensure it exists.");
}
}


/*
* Close a file through the POSIX interface.
*/
Expand Down
21 changes: 20 additions & 1 deletion src/aiori-S3.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ static void S3_Fsync(void*, IOR_param_t*);
static IOR_offset_t S3_GetFileSize(IOR_param_t*, MPI_Comm, char*);
static void S3_init();
static void S3_finalize();
static int S3_check_params(IOR_param_t *);


/************************** D E C L A R A T I O N S ***************************/

Expand All @@ -177,7 +179,8 @@ ior_aiori_t s3_aiori = {
.fsync = S3_Fsync,
.get_file_size = S3_GetFileSize,
.initialize = S3_init,
.finalize = S3_finalize
.finalize = S3_finalize,
.check_params = S3_check_params
};

// "S3", plus EMC-extensions enabled
Expand Down Expand Up @@ -228,6 +231,22 @@ static void S3_finalize(){
aws_cleanup();
}

static int S3_check_params(IOR_param_t * test){
/* N:1 and N:N */
IOR_offset_t NtoN = test->filePerProc;
IOR_offset_t Nto1 = ! NtoN;
IOR_offset_t s = test->segmentCount;
IOR_offset_t t = test->transferSize;
IOR_offset_t b = test->blockSize;

if (Nto1 && (s != 1) && (b != t)) {
ERR("N:1 (strided) requires xfer-size == block-size");
return 0;
}

return 1;
}

/* modelled on similar macros in iordef.h */
#define CURL_ERR(MSG, CURL_ERRNO, PARAM) \
do { \
Expand Down
2 changes: 2 additions & 0 deletions src/aiori.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ typedef struct ior_aiori {
void (*finalize)(); /* called once per program after MPI is shutdown */
option_help * (*get_options)(void ** init_backend_options, void* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */
bool enable_mdtest;
int (*check_params)(IOR_param_t *); /* check if the provided parameters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/
void (*sync)(IOR_param_t * ); /* synchronize every pending operation for this storage */
} ior_aiori_t;

enum bench_type {
Expand Down
15 changes: 6 additions & 9 deletions src/ior.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,15 +1677,12 @@ static void ValidateTests(IOR_param_t * test)
if (test->useExistingTestFile && test->lustre_set_striping)
ERR("Lustre stripe options are incompatible with useExistingTestFile");

/* N:1 and N:N */
IOR_offset_t NtoN = test->filePerProc;
IOR_offset_t Nto1 = ! NtoN;
IOR_offset_t s = test->segmentCount;
IOR_offset_t t = test->transferSize;
IOR_offset_t b = test->blockSize;

if (Nto1 && (s != 1) && (b != t)) {
ERR("N:1 (strided) requires xfer-size == block-size");
/* allow the backend to validate the options */
if(test->backend->check_params){
int check = test->backend->check_params(test);
if (check == 0){
ERR("The backend returned that the test parameters are invalid.");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach is fine by me instead of #177. Thanks for including this to fix that issue.

}
}

Expand Down
50 changes: 25 additions & 25 deletions src/mdtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ static size_t write_bytes;
static int stone_wall_timer_seconds;
static size_t read_bytes;
static int sync_file;
static int call_sync;
static int path_count;
static int nstride; /* neighbor stride */
static int make_node = 0;
Expand Down Expand Up @@ -263,6 +264,19 @@ static void prep_testdir(int j, int dir_iter){
pos += sprintf(& testdir[pos], ".%d-%d", j, dir_iter);
}

static void phase_end(){
if (call_sync){
if(! backend->sync){
FAIL("Error, backend does not provide the sync method, but your requested to use sync.");
}
backend->sync(& param);
}

if (barriers) {
MPI_Barrier(testComm);
}
}

/*
* This function copies the unique directory name for a given option to
* the "to" parameter. Some memory must be allocated to the "to" parameter.
Expand Down Expand Up @@ -836,9 +850,7 @@ void directory_test(const int iteration, const int ntasks, const char *path, ran
}
}

if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[1] = GetTimeStamp();

/* stat phase */
Expand All @@ -864,10 +876,7 @@ void directory_test(const int iteration, const int ntasks, const char *path, ran
}
}
}

if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[2] = GetTimeStamp();

/* read phase */
Expand All @@ -894,9 +903,7 @@ void directory_test(const int iteration, const int ntasks, const char *path, ran
}
}

if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[3] = GetTimeStamp();

if (remove_only) {
Expand Down Expand Up @@ -924,9 +931,7 @@ void directory_test(const int iteration, const int ntasks, const char *path, ran
}
}

if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[4] = GetTimeStamp();

if (remove_only) {
Expand Down Expand Up @@ -1082,9 +1087,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
}
}

if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[1] = GetTimeStamp();

/* stat phase */
Expand All @@ -1107,9 +1110,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
}
}

if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[2] = GetTimeStamp();

/* read phase */
Expand All @@ -1136,9 +1137,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
}
}

if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[3] = GetTimeStamp();

if (remove_only) {
Expand Down Expand Up @@ -1168,9 +1167,7 @@ void file_test(const int iteration, const int ntasks, const char *path, rank_pro
}
}

if (barriers) {
MPI_Barrier(testComm);
}
phase_end();
t[4] = GetTimeStamp();
if (remove_only) {
if (unique_dir_per_task) {
Expand Down Expand Up @@ -1853,6 +1850,7 @@ void mdtest_init_args(){
stone_wall_timer_seconds = 0;
read_bytes = 0;
sync_file = 0;
call_sync = 0;
path_count = 0;
nstride = 0;
make_node = 0;
Expand Down Expand Up @@ -1925,6 +1923,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE *
{'x', NULL, "StoneWallingStatusFile; contains the number of iterations of the creation phase, can be used to split phases across runs", OPTION_OPTIONAL_ARGUMENT, 's', & stoneWallingStatusFile},
{'X', "verify-read", "Verify the data read", OPTION_FLAG, 'd', & verify_read},
{'y', NULL, "sync file after writing", OPTION_FLAG, 'd', & sync_file},
{'Y', NULL, "call the sync command after each phase (included in the timing; note it causes all IO to be flushed from your node)", OPTION_FLAG, 'd', & call_sync},
{'z', NULL, "depth of hierarchical directory structure", OPTION_OPTIONAL_ARGUMENT, 'd', & depth},
{'Z', NULL, "print time instead of rate", OPTION_FLAG, 'd', & print_time},
LAST_OPTION
Expand Down Expand Up @@ -2008,6 +2007,7 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE *
VERBOSE(1,-1, "unique_dir_per_task : %s", ( unique_dir_per_task ? "True" : "False" ));
VERBOSE(1,-1, "write_bytes : "LLU"", write_bytes );
VERBOSE(1,-1, "sync_file : %s", ( sync_file ? "True" : "False" ));
VERBOSE(1,-1, "call_sync : %s", ( call_sync ? "True" : "False" ));
VERBOSE(1,-1, "depth : %d", depth );
VERBOSE(1,-1, "make_node : %d", make_node );

Expand Down
10 changes: 5 additions & 5 deletions src/utilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ void* safeMalloc(uint64_t size){
}

void FailMessage(int rank, const char *location, char *format, ...) {
char msg[4096];
char msg[4096];
va_list args;
va_start(args, format);
vsnprintf(msg, 4096, format, args);
va_end(args);
fprintf(out_logfile, "%s: Process %d: FAILED in %s, %s: %s\n",
PrintTimestamp(), rank, location, msg, strerror(errno));
fflush(out_logfile);
MPI_Abort(testComm, 1);
fprintf(out_logfile, "%s: Process %d: FAILED in %s, %s: %s\n",
PrintTimestamp(), rank, location, msg, strerror(errno));
fflush(out_logfile);
MPI_Abort(testComm, 1);
}

size_t NodeMemoryStringToBytes(char *size_str)
Expand Down