Skip to content

Commit

Permalink
making some changes suggested by codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Mar 7, 2019
1 parent bfd150e commit cf8fecf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/clib/pioc_sc.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ PIO_Offset GCDblocksize(int arrlen, const PIO_Offset *arr_in)
if (!(loc_arr = malloc(sizeof(PIO_Offset) * (arrlen - 1))))
return PIO_ENOMEM;
if (!(del_arr = malloc(sizeof(PIO_Offset) * (arrlen - 1))))
{
free(loc_arr);
return PIO_ENOMEM;
}

/* Count the number of contiguous blocks in arr_in. If any if
these blocks is of size 1, we are done and can return.
Expand Down
7 changes: 2 additions & 5 deletions tests/cunit/test_perf1.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ int create_decomposition_3d(int ntasks, int my_rank, int iosysid, int *dim_len_3
int
do_some_computation(long long int max_i)
{
float a, b, c;
for (int i = 0; i < max_i; i++)
{
float a, b, c;
a = b * c;
b = a * c;
c = a * b;
Expand Down Expand Up @@ -224,8 +224,6 @@ int test_perf1(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank,
if ((ret = PIOc_setframe(ncid, varid[v], t)))
ERR(ret);

int frame = 0;
int flushtodisk = test_multi - 1;
if (!test_multi)
{
/* Write the data. */
Expand Down Expand Up @@ -269,7 +267,6 @@ int run_benchmark(int iosysid, int num_flavors, int *flavor, int my_rank, int nt
{
int ioid, ioid3;
char filename[NC_MAX_NAME + 1];
int dim_len_2d[NDIM2] = {X_DIM_LEN, Y_DIM_LEN};
int dim_len_3d[NDIM3] = {Z_DIM_LEN, X_DIM_LEN, Y_DIM_LEN};
long long delta;
int ret; /* Return code. */
Expand Down Expand Up @@ -319,13 +316,13 @@ run_some_benchmarks(MPI_Comm test_comm, int my_rank, int ntasks, int num_flavors
int iosysid; /* The ID for the parallel I/O system. */
int ioproc_stride = 1; /* Stride in the mpi rank between io tasks. */
int ioproc_start = 0; /* Zero based rank of first processor to be used for I/O. */
int ret; /* Return code. */

if (!my_rank)
printf("rearr\tfmt\tpio_type\ttest_multi\ttime\n");
/* for (int r = 0; r < num_rearr; r++) */
for (int r = 0; r < 1; r++)
{
int ret; /* Return code. */

/* Initialize the PIO IO system. This specifies how
* many and which processors are involved in I/O. */
Expand Down
11 changes: 9 additions & 2 deletions tests/cunit/test_perf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,16 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
if (!(test_data = malloc(sizeof(int) * arraylen)))
ERR(PIO_ENOMEM);
if (!(test_data2 = malloc(sizeof(int) * arraylen)))
{
free(test_data);
ERR(PIO_ENOMEM);
}
if (!(test_data_in = malloc(sizeof(int) * arraylen)))
{
free(test_data);
free(test_data2);
ERR(PIO_ENOMEM);
}

/* Initialize some data. */
for (int f = 0; f < arraylen; f++)
Expand Down Expand Up @@ -373,8 +380,6 @@ int main(int argc, char **argv)
{
int my_rank;
int ntasks;
int num_flavors; /* Number of PIO netCDF flavors in this build. */
int flavor[NUM_FLAVORS]; /* iotypes for the supported netCDF IO flavors. */
MPI_Comm test_comm; /* A communicator for this test. */
int ret; /* Return code. */

Expand All @@ -393,6 +398,8 @@ int main(int argc, char **argv)
int iosysid; /* The ID for the parallel I/O system. */
int ioproc_stride = 1; /* Stride in the mpi rank between io tasks. */
int ioproc_start = 0; /* Zero based rank of first processor to be used for I/O. */
int num_flavors; /* Number of PIO netCDF flavors in this build. */
int flavor[NUM_FLAVORS]; /* iotypes for the supported netCDF IO flavors. */
int ret; /* Return code. */

/* Figure out iotypes. */
Expand Down

0 comments on commit cf8fecf

Please sign in to comment.