Skip to content

Commit

Permalink
Merge pull request ESMCI#1247 from NCAR/maxblocksize_fix
Browse files Browse the repository at this point in the history
more reasonable maxblock value
  • Loading branch information
jedwards4b authored Dec 15, 2017
2 parents 0f241db + 39e4f11 commit fbc22da
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/clib/pioc_sc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <pio.h>
#include <pio_internal.h>

/** The default target blocksize for each io task when the box
/** The default target blocksize in bytes for each io task when the box
* rearranger is used. */
#define DEFAULT_BLOCKSIZE 1024

Expand All @@ -22,7 +22,7 @@ int blocksize = DEFAULT_BLOCKSIZE;
*
* @param a
* @param b
* @returns greates common divisor.
* @returns greatest common divisor.
* @author Jim Edwards
*/
int gcd(int a, int b )
Expand Down Expand Up @@ -275,9 +275,8 @@ int CalcStartandCount(int pio_type, int ndims, const int *gdims, int num_io_proc
/* We are trying to find start and count indices for each iotask
* such that each task has approximately blocksize data to write
* (read). The number of iotasks participating in the operation is
* blocksize/global_size. */
* global_size/blocksize. */
minbytes = blocksize - 256;
maxbytes = blocksize + 256;

/* Determine the size of the data type. */
if ((ret = find_mpi_type(pio_type, NULL, &basesize)))
Expand All @@ -295,6 +294,8 @@ int CalcStartandCount(int pio_type, int ndims, const int *gdims, int num_io_proc
* blocksize data on each iotask*/
use_io_procs = max(1, min((int)((float)pgdims / (float)minblocksize + 0.5), num_io_procs));

maxbytes = max(blocksize, pgdims * basesize / use_io_procs) + 256;

/* Initialize to 0. */
converged = 0;
for (i = 0; i < ndims; i++)
Expand Down

0 comments on commit fbc22da

Please sign in to comment.