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

Improved checksum management #19

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2012-2021 Argonne National Laboratory
Copyright (c) 2021 Inria

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
1 change: 1 addition & 0 deletions cuda/XSbench_header.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ typedef struct{
int simulation_method;
int binary_mode;
int kernel_id;
int user_g;
} Inputs;

typedef struct{
Expand Down
41 changes: 26 additions & 15 deletions cuda/io.cu
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
MPI_SUM, 0, MPI_COMM_WORLD);
#endif

int is_invalid_result = 1;
int is_invalid_result = 0;

// Print output
if( mype == 0 )
Expand All @@ -77,6 +77,7 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
#endif
}

int checksum_is_defined = 0;
unsigned long long large = 0;
unsigned long long small = 0;
if( in.simulation_method == EVENT_BASED )
Expand All @@ -91,25 +92,35 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
}
if( strcmp(in.HM, "large") == 0 )
{
if( vhash == large )
is_invalid_result = 0;
checksum_is_defined = 1;
if( vhash != large )
is_invalid_result = 1;
}
else if( strcmp(in.HM, "small") == 0 )
{
if( vhash == small )
is_invalid_result = 0;
checksum_is_defined = 1;
if( vhash != small )
is_invalid_result = 1;
}
if( in.user_g )
{
checksum_is_defined = 0;
}

if(mype == 0 )
{
if( is_invalid_result )
printf("Verification checksum: %llu (WARNING - INAVALID CHECKSUM!)\n", vhash);
if( checksum_is_defined && is_invalid_result )
printf("Verification checksum: %llu (WARNING - INVALID CHECKSUM!)\n", vhash);
else if( in.user_g )
printf("WARNING - Unable to verify due to custom size (checksum: %llu)\n", vhash);
else if( !checksum_is_defined )
printf("WARNING - Unable to verify due to unsupported size (checksum: %llu)\n", vhash);
else
printf("Verification checksum: %llu (Valid)\n", vhash);
border_print();
}

return is_invalid_result;
return checksum_is_defined && is_invalid_result;
}

void print_inputs(Inputs in, int nprocs, int version )
Expand Down Expand Up @@ -266,7 +277,7 @@ Inputs read_CLI( int argc, char * argv[] )
input.HM[5] = '\0';

// Check if user sets these
int user_g = 0;
input.user_g = 0;

int default_lookups = 1;
int default_particles = 1;
Expand All @@ -281,7 +292,7 @@ Inputs read_CLI( int argc, char * argv[] )
{
if( ++i < argc )
{
user_g = 1;
input.user_g = 1;
input.n_gridpoints = atol(argv[i]);
}
else
Expand All @@ -290,7 +301,7 @@ Inputs read_CLI( int argc, char * argv[] )
// Simulation Method (-m)
else if( strcmp(arg, "-m") == 0 )
{
char * sim_type;
char * sim_type = NULL;
if( ++i < argc )
sim_type = argv[i];
else
Expand Down Expand Up @@ -352,7 +363,7 @@ Inputs read_CLI( int argc, char * argv[] )
// grid type (-G)
else if( strcmp(arg, "-G") == 0 )
{
char * grid_type;
char * grid_type = NULL;
if( ++i < argc )
grid_type = argv[i];
else
Expand All @@ -370,7 +381,7 @@ Inputs read_CLI( int argc, char * argv[] )
// binary mode (-b)
else if( strcmp(arg, "-b") == 0 )
{
char * binary_mode;
char * binary_mode = NULL;
if( ++i < argc )
binary_mode = argv[i];
else
Expand Down Expand Up @@ -430,9 +441,9 @@ Inputs read_CLI( int argc, char * argv[] )
// (defaults to large)
if( strcasecmp(input.HM, "small") == 0 )
input.n_isotopes = 68;
else if( strcasecmp(input.HM, "XL") == 0 && user_g == 0 )
else if( strcasecmp(input.HM, "XL") == 0 && input.user_g == 0 )
input.n_gridpoints = 238847; // sized to make 120 GB XS data
else if( strcasecmp(input.HM, "XXL") == 0 && user_g == 0 )
else if( strcasecmp(input.HM, "XXL") == 0 && input.user_g == 0 )
input.n_gridpoints = 238847 * 2.1; // 252 GB XS data

// Return input struct
Expand Down
1 change: 1 addition & 0 deletions opencl/XSbench_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ typedef struct{
int simulation_method;
int binary_mode;
int kernel_id;
int user_g;
int platform_id;
int device_id;
} Inputs;
Expand Down
41 changes: 26 additions & 15 deletions opencl/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
MPI_SUM, 0, MPI_COMM_WORLD);
#endif

int is_invalid_result = 1;
int is_invalid_result = 0;

// Print output
if( mype == 0 )
Expand Down Expand Up @@ -88,6 +88,7 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
#endif
}

int checksum_is_defined = 0;
unsigned long long large = 0;
unsigned long long small = 0;
if( in.simulation_method == EVENT_BASED )
Expand All @@ -102,25 +103,35 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
}
if( in.HM == LARGE )
{
if( vhash == large )
is_invalid_result = 0;
checksum_is_defined = 1;
if( vhash != large )
is_invalid_result = 1;
}
else if( in.HM == SMALL )
{
if( vhash == small )
is_invalid_result = 0;
checksum_is_defined = 1;
if( vhash != small )
is_invalid_result = 1;
}
if( in.user_g )
{
checksum_is_defined = 0;
}

if(mype == 0 )
{
if( is_invalid_result )
printf("Verification checksum: %llu (WARNING - INAVALID CHECKSUM!)\n", vhash);
if( checksum_is_defined && is_invalid_result )
printf("Verification checksum: %llu (WARNING - INVALID CHECKSUM!)\n", vhash);
else if( in.user_g )
printf("WARNING - Unable to verify due to custom size (checksum: %llu)\n", vhash);
else if( !checksum_is_defined )
printf("WARNING - Unable to verify due to unsupported size (checksum: %llu)\n", vhash);
else
printf("Verification checksum: %llu (Valid)\n", vhash);
border_print();
}

return is_invalid_result;
return checksum_is_defined && is_invalid_result;
}

void print_inputs(Inputs in, int nprocs, int version )
Expand Down Expand Up @@ -287,7 +298,7 @@ Inputs read_CLI( int argc, char * argv[] )
input.device_id = -1;

// Check if user sets these
int user_g = 0;
input.user_g = 0;

int default_lookups = 1;
int default_particles = 1;
Expand All @@ -302,7 +313,7 @@ Inputs read_CLI( int argc, char * argv[] )
{
if( ++i < argc )
{
user_g = 1;
input.user_g = 1;
input.n_gridpoints = atol(argv[i]);
}
else
Expand All @@ -311,7 +322,7 @@ Inputs read_CLI( int argc, char * argv[] )
// Simulation Method (-m)
else if( strcmp(arg, "-m") == 0 )
{
char * sim_type;
char * sim_type = NULL;
if( ++i < argc )
sim_type = argv[i];
else
Expand Down Expand Up @@ -383,7 +394,7 @@ Inputs read_CLI( int argc, char * argv[] )
// grid type (-G)
else if( strcmp(arg, "-G") == 0 )
{
char * grid_type;
char * grid_type = NULL;
if( ++i < argc )
grid_type = argv[i];
else
Expand All @@ -401,7 +412,7 @@ Inputs read_CLI( int argc, char * argv[] )
// binary mode (-b)
else if( strcmp(arg, "-b") == 0 )
{
char * binary_mode;
char * binary_mode = NULL;
if( ++i < argc )
binary_mode = argv[i];
else
Expand Down Expand Up @@ -470,9 +481,9 @@ Inputs read_CLI( int argc, char * argv[] )
// (defaults to large)
if( input.HM == SMALL )
input.n_isotopes = 68;
else if( input.HM == XL && user_g == 0 )
else if( input.HM == XL && input.user_g == 0 )
input.n_gridpoints = 238847; // sized to make 120 GB XS data
else if( input.HM == XXL && user_g == 0 )
else if( input.HM == XXL && input.user_g == 0 )
input.n_gridpoints = 238847 * 2.1; // 252 GB XS data

// Return input struct
Expand Down
1 change: 1 addition & 0 deletions openmp-offload/XSbench_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ typedef struct{
int simulation_method;
int binary_mode;
int kernel_id;
int user_g;
} Inputs;

typedef struct{
Expand Down
41 changes: 26 additions & 15 deletions openmp-offload/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
MPI_SUM, 0, MPI_COMM_WORLD);
#endif

int is_invalid_result = 1;
int is_invalid_result = 0;

// Print output
if( mype == 0 )
Expand All @@ -81,6 +81,7 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
#endif
}

int checksum_is_defined = 0;
unsigned long long large = 0;
unsigned long long small = 0;
if( in.simulation_method == EVENT_BASED )
Expand All @@ -95,25 +96,35 @@ int print_results( Inputs in, int mype, double runtime, int nprocs,
}
if( strcmp(in.HM, "large") == 0 )
{
if( vhash == large )
is_invalid_result = 0;
checksum_is_defined = 1;
if( vhash != large )
is_invalid_result = 1;
}
else if( strcmp(in.HM, "small") == 0 )
{
if( vhash == small )
is_invalid_result = 0;
checksum_is_defined = 1;
if( vhash != small )
is_invalid_result = 1;
}
if( in.user_g )
{
checksum_is_defined = 0;
}

if(mype == 0 )
{
if( is_invalid_result )
printf("Verification checksum: %llu (WARNING - INAVALID CHECKSUM!)\n", vhash);
if( checksum_is_defined && is_invalid_result )
printf("Verification checksum: %llu (WARNING - INVALID CHECKSUM!)\n", vhash);
else if( in.user_g )
printf("WARNING - Unable to verify due to custom size (checksum: %llu)\n", vhash);
else if( !checksum_is_defined )
printf("WARNING - Unable to verify due to unsupported size (checksum: %llu)\n", vhash);
else
printf("Verification checksum: %llu (Valid)\n", vhash);
border_print();
}

return is_invalid_result;
return checksum_is_defined && is_invalid_result;
}

void print_inputs(Inputs in, int nprocs, int version )
Expand Down Expand Up @@ -265,7 +276,7 @@ Inputs read_CLI( int argc, char * argv[] )
input.HM[5] = '\0';

// Check if user sets these
int user_g = 0;
input.user_g = 0;

int default_lookups = 1;
int default_particles = 1;
Expand All @@ -280,7 +291,7 @@ Inputs read_CLI( int argc, char * argv[] )
{
if( ++i < argc )
{
user_g = 1;
input.user_g = 1;
input.n_gridpoints = atol(argv[i]);
}
else
Expand All @@ -289,7 +300,7 @@ Inputs read_CLI( int argc, char * argv[] )
// Simulation Method (-m)
else if( strcmp(arg, "-m") == 0 )
{
char * sim_type;
char * sim_type = NULL;
if( ++i < argc )
sim_type = argv[i];
else
Expand Down Expand Up @@ -351,7 +362,7 @@ Inputs read_CLI( int argc, char * argv[] )
// grid type (-G)
else if( strcmp(arg, "-G") == 0 )
{
char * grid_type;
char * grid_type = NULL;
if( ++i < argc )
grid_type = argv[i];
else
Expand All @@ -369,7 +380,7 @@ Inputs read_CLI( int argc, char * argv[] )
// binary mode (-b)
else if( strcmp(arg, "-b") == 0 )
{
char * binary_mode;
char * binary_mode = NULL;
if( ++i < argc )
binary_mode = argv[i];
else
Expand Down Expand Up @@ -429,9 +440,9 @@ Inputs read_CLI( int argc, char * argv[] )
// (defaults to large)
if( strcasecmp(input.HM, "small") == 0 )
input.n_isotopes = 68;
else if( strcasecmp(input.HM, "XL") == 0 && user_g == 0 )
else if( strcasecmp(input.HM, "XL") == 0 && input.user_g == 0 )
input.n_gridpoints = 238847; // sized to make 120 GB XS data
else if( strcasecmp(input.HM, "XXL") == 0 && user_g == 0 )
else if( strcasecmp(input.HM, "XXL") == 0 && input.user_g == 0 )
input.n_gridpoints = 238847 * 2.1; // 252 GB XS data

// Return input struct
Expand Down
1 change: 1 addition & 0 deletions openmp-threading/XSbench_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ typedef struct{
int simulation_method;
int binary_mode;
int kernel_id;
int user_g;
} Inputs;

typedef struct{
Expand Down
Loading