Skip to content

Commit

Permalink
Add sparse array operations to main development branch (#351)
Browse files Browse the repository at this point in the history
* Initial check in to save changes. Code does not work.

* Adding more functionality to sparse arrays. The array class builds but has not
been tested.

* Added sparse array routines to user interface and to the build system.

* Test program for sparse array functionality.

* Code works on 1 processor. Saving changes.

* Checking in code that works on one and two processors.

* Tests are now running up to 3 processors

* Adding some debugging prints.

* Fixed data type mismatch.

* Fixed up a bug in the add element function, removed prints and increased size of
test problem.

* Fixed up test of matrix-vector multiply. Still need to get a consistent handling
of indexing.

* Fixed up indexing so that everthing is zero base.

* Modified code to do a better job of handling integer sizes in C-interface.

* Added some modifications to build and sparse array to support test case that
solves Laplace's equation using a conjugate gradient algorithm.

* Added test case to solve Laplace's equation using conjugate gradient algorithm.

* Added some code so you can write out a VTK formatted file containing the
solution. This can be visualized using something like VisIt or Paraview.

* Added a sparse matrix-vector multiply routine to the sparse array operations.

* Cleaned up header files and modified laplace.x test case to allocation more
memory in MA.

* Fixed up a bug in sparse array assembly operation.

* Adding asynchronous implementations to repository.

* Added BiCG-STAB implementation to test code for sparse matrices.

* Initial checkin of solver based on randomized Kaczmarz.

* Initial checkin of asynchronous Kaczmarz solver.

* Fixed up some bugs in Kaczmarz solve. It appears to run at this point.

* Normalized row of A and b to improve solution.

* Initialized internal array handles to invalid value and added some code
to compare Kaczmarz solution to conjugate gradient.

* Modified data layout so that processor blocks are laid out consecutively in
distributed memory.

* Fixed export of VTK visualization file.

* Modified code so it is easy to switch back and forth from old slab
distribution to block distribution and cleaned up output to VTK file.

* Added some code to calculate the distribution of errors.

* Added code to print out distribution of differences and print out differences
between exact and Kaczmarz answers to VTK file.

* Added routine to export sparse matrix to an ASCII file.

* Added operations to get the diagonal of a sparse matrix, left multiply a sparse
matrix with a diagonal matrix represented by a vector, and shift the diagonal of
a sparse matrix by a constant amount.

* Added function to create a duplicate of a sparse array.

* Cleaned up sparse array operations so that they work for all data types and
added operations to multiply a sparse matrix by a diagonal matrix.

* Modified Makefile.am so that some test that have not been checked in are
not being run.

* Fixed up some bugs in shift_diag macros.

* Fix up factorization routine.

* Fix up fortran interface to handle pointers correctly.

* Fixed up some bugs in fortran interface and added functionality to extract
single sparse blocks from sparse array.

* Capture some updates.

* Capture some recent changes.

* Added sprs_test.c file to repository to fix compilation error in
CI.

* Removed randomcg from testing.

* Removed additional asynchronous algorithms that don't work from testing.

* Initial checkin of j_iter.c

* Capture latest changes to matrix-matrix multiply routine. Currently compiles but
not tested to see if it works.

* Added matrix-matrix multiply operation to sparse array library.

* Modified code so that buffers for matrix-matrix multiply are preallocated. This
eliminates the need to keep resizing buffers on the fly.

* Added tests to verify all non-zeros appear in matrix-matrix multiply and put
timers on all sparse matrix operations.

* Fixed bug in add element routine that was not correctly resizing arrays.

* Fixed up some additional bugs with temporary arrays for holding sparse array indices.

* Added fixes to sparse matrix-matrix multiply operation.

* Added functionality to extract column from sparse matrix.

* Fixed up count_sketch function and added test for it to sprs_test.c

* Added files for random number generator based on Mersenne twister and a file
implementing count sketch algorithm.

* Add file implementing random Gram-Schmidt orthogonalization algorithm.

* Replaced ran3 random number generator with Mersenne twister implementation and
added test for routines implementing count sketch algorithm.

* Added Mersenne twister to build files, fixed up sparse array export module and
added some minor bug fixes.

* Checking in some fixes for linear arrays and capturing current state of random
Gram-Schmidt orthogonalization code.

* Added test for random number generator.

* Added test for random number generator to build.

* Added new functionality for mixed sparse-dense operations.

* Added synchronization and mask variables to all global operations.

* Initial check in to save changes. Code does not work.

* Adding more functionality to sparse arrays. The array class builds but has not
been tested.

* Added sparse array routines to user interface and to the build system.

* Test program for sparse array functionality.

* Code works on 1 processor. Saving changes.

* Checking in code that works on one and two processors.

* Tests are now running up to 3 processors

* Adding some debugging prints.

* Fixed data type mismatch.

* Fixed up a bug in the add element function, removed prints and increased size of
test problem.

* Fixed up test of matrix-vector multiply. Still need to get a consistent handling
of indexing.

* Fixed up indexing so that everthing is zero base.

* Modified code to do a better job of handling integer sizes in C-interface.

* Added some modifications to build and sparse array to support test case that
solves Laplace's equation using a conjugate gradient algorithm.

* Added test case to solve Laplace's equation using conjugate gradient algorithm.

* Added some code so you can write out a VTK formatted file containing the
solution. This can be visualized using something like VisIt or Paraview.

* Added a sparse matrix-vector multiply routine to the sparse array operations.

* Cleaned up header files and modified laplace.x test case to allocation more
memory in MA.

* Fixed up a bug in sparse array assembly operation.

* Adding asynchronous implementations to repository.

* Added BiCG-STAB implementation to test code for sparse matrices.

* Initial checkin of solver based on randomized Kaczmarz.

* Initial checkin of asynchronous Kaczmarz solver.

* Fixed up some bugs in Kaczmarz solve. It appears to run at this point.

* Normalized row of A and b to improve solution.

* Initialized internal array handles to invalid value and added some code
to compare Kaczmarz solution to conjugate gradient.

* Modified data layout so that processor blocks are laid out consecutively in
distributed memory.

* Fixed export of VTK visualization file.

* Modified code so it is easy to switch back and forth from old slab
distribution to block distribution and cleaned up output to VTK file.

* Added some code to calculate the distribution of errors.

* Added code to print out distribution of differences and print out differences
between exact and Kaczmarz answers to VTK file.

* Added routine to export sparse matrix to an ASCII file.

* Added operations to get the diagonal of a sparse matrix, left multiply a sparse
matrix with a diagonal matrix represented by a vector, and shift the diagonal of
a sparse matrix by a constant amount.

* Added function to create a duplicate of a sparse array.

* Cleaned up sparse array operations so that they work for all data types and
added operations to multiply a sparse matrix by a diagonal matrix.

* Modified Makefile.am so that some test that have not been checked in are
not being run.

* Fixed up some bugs in shift_diag macros.

* Fix up factorization routine.

* Fix up fortran interface to handle pointers correctly.

* Fixed up some bugs in fortran interface and added functionality to extract
single sparse blocks from sparse array.

* Capture some updates.

* Capture some recent changes.

* Added sprs_test.c file to repository to fix compilation error in
CI.

* Removed randomcg from testing.

* Removed additional asynchronous algorithms that don't work from testing.

* Initial checkin of j_iter.c

* Capture latest changes to matrix-matrix multiply routine. Currently compiles but
not tested to see if it works.

* Added matrix-matrix multiply operation to sparse array library.

* Modified code so that buffers for matrix-matrix multiply are preallocated. This
eliminates the need to keep resizing buffers on the fly.

* Added tests to verify all non-zeros appear in matrix-matrix multiply and put
timers on all sparse matrix operations.

* Fixed bug in add element routine that was not correctly resizing arrays.

* Fixed up some additional bugs with temporary arrays for holding sparse array indices.

* Added fixes to sparse matrix-matrix multiply operation.

* Added functionality to extract column from sparse matrix.

* Fixed up count_sketch function and added test for it to sprs_test.c

* Added files for random number generator based on Mersenne twister and a file
implementing count sketch algorithm.

* Add file implementing random Gram-Schmidt orthogonalization algorithm.

* Replaced ran3 random number generator with Mersenne twister implementation and
added test for routines implementing count sketch algorithm.

* Added Mersenne twister to build files, fixed up sparse array export module and
added some minor bug fixes.

* Checking in some fixes for linear arrays and capturing current state of random
Gram-Schmidt orthogonalization code.

* Added test for random number generator.

* Added test for random number generator to build.

* Added new functionality for mixed sparse-dense operations.

* Added synchronization and mask variables to all global operations.

* fix NGA_Sprs_array_access_col_block64 definition

* [cmake] new routines for sparse arrays

* Fixed up a few problem so that test suite runs.

* Added sparse to dense conversion routine to sparse matrix api.

* Initial check in to save changes. Code does not work.

* Adding more functionality to sparse arrays. The array class builds but has not
been tested.

* Added sparse array routines to user interface and to the build system.

* Test program for sparse array functionality.

* Code works on 1 processor. Saving changes.

* Checking in code that works on one and two processors.

* Tests are now running up to 3 processors

* Adding some debugging prints.

* Fixed data type mismatch.

* Fixed up a bug in the add element function, removed prints and increased size of
test problem.

* Fixed up test of matrix-vector multiply. Still need to get a consistent handling
of indexing.

* Fixed up indexing so that everthing is zero base.

* Modified code to do a better job of handling integer sizes in C-interface.

* Added some modifications to build and sparse array to support test case that
solves Laplace's equation using a conjugate gradient algorithm.

* Added test case to solve Laplace's equation using conjugate gradient algorithm.

* Added some code so you can write out a VTK formatted file containing the
solution. This can be visualized using something like VisIt or Paraview.

* Added a sparse matrix-vector multiply routine to the sparse array operations.

* Cleaned up header files and modified laplace.x test case to allocation more
memory in MA.

* Fixed up a bug in sparse array assembly operation.

* Adding asynchronous implementations to repository.

* Added BiCG-STAB implementation to test code for sparse matrices.

* Initial checkin of solver based on randomized Kaczmarz.

* Initial checkin of asynchronous Kaczmarz solver.

* Fixed up some bugs in Kaczmarz solve. It appears to run at this point.

* Normalized row of A and b to improve solution.

* Initialized internal array handles to invalid value and added some code
to compare Kaczmarz solution to conjugate gradient.

* Modified data layout so that processor blocks are laid out consecutively in
distributed memory.

* Fixed export of VTK visualization file.

* Modified code so it is easy to switch back and forth from old slab
distribution to block distribution and cleaned up output to VTK file.

* Added some code to calculate the distribution of errors.

* Added code to print out distribution of differences and print out differences
between exact and Kaczmarz answers to VTK file.

* Added routine to export sparse matrix to an ASCII file.

* Added operations to get the diagonal of a sparse matrix, left multiply a sparse
matrix with a diagonal matrix represented by a vector, and shift the diagonal of
a sparse matrix by a constant amount.

* Added function to create a duplicate of a sparse array.

* Cleaned up sparse array operations so that they work for all data types and
added operations to multiply a sparse matrix by a diagonal matrix.

* Modified Makefile.am so that some test that have not been checked in are
not being run.

* Fixed up some bugs in shift_diag macros.

* Fix up factorization routine.

* Fix up fortran interface to handle pointers correctly.

* Fixed up some bugs in fortran interface and added functionality to extract
single sparse blocks from sparse array.

* Capture some updates.

* Capture some recent changes.

* Added sprs_test.c file to repository to fix compilation error in
CI.

* Removed randomcg from testing.

* Removed additional asynchronous algorithms that don't work from testing.

* Initial checkin of j_iter.c

* Capture latest changes to matrix-matrix multiply routine. Currently compiles but
not tested to see if it works.

* Added matrix-matrix multiply operation to sparse array library.

* Modified code so that buffers for matrix-matrix multiply are preallocated. This
eliminates the need to keep resizing buffers on the fly.

* Added tests to verify all non-zeros appear in matrix-matrix multiply and put
timers on all sparse matrix operations.

* Fixed bug in add element routine that was not correctly resizing arrays.

* Fixed up some additional bugs with temporary arrays for holding sparse array indices.

* Added fixes to sparse matrix-matrix multiply operation.

* Added functionality to extract column from sparse matrix.

* Fixed up count_sketch function and added test for it to sprs_test.c

* Added files for random number generator based on Mersenne twister and a file
implementing count sketch algorithm.

* Add file implementing random Gram-Schmidt orthogonalization algorithm.

* Replaced ran3 random number generator with Mersenne twister implementation and
added test for routines implementing count sketch algorithm.

* Added Mersenne twister to build files, fixed up sparse array export module and
added some minor bug fixes.

* Checking in some fixes for linear arrays and capturing current state of random
Gram-Schmidt orthogonalization code.

* Added test for random number generator.

* Added test for random number generator to build.

* Added new functionality for mixed sparse-dense operations.

* Added synchronization and mask variables to all global operations.

* Initial check in to save changes. Code does not work.

* Added sparse array routines to user interface and to the build system.

* Code works on 1 processor. Saving changes.

* Checking in code that works on one and two processors.

* Tests are now running up to 3 processors

* Adding some debugging prints.

* Fixed data type mismatch.

* Fixed up a bug in the add element function, removed prints and increased size of
test problem.

* Modified code to do a better job of handling integer sizes in C-interface.

* Added some modifications to build and sparse array to support test case that
solves Laplace's equation using a conjugate gradient algorithm.

* Added a sparse matrix-vector multiply routine to the sparse array operations.

* Cleaned up header files and modified laplace.x test case to allocation more
memory in MA.

* Fixed up a bug in sparse array assembly operation.

* Initial checkin of solver based on randomized Kaczmarz.

* Fixed up some bugs in Kaczmarz solve. It appears to run at this point.

* Normalized row of A and b to improve solution.

* Initialized internal array handles to invalid value and added some code
to compare Kaczmarz solution to conjugate gradient.

* Added some code to calculate the distribution of errors.

* Added routine to export sparse matrix to an ASCII file.

* Added function to create a duplicate of a sparse array.

* Cleaned up sparse array operations so that they work for all data types and
added operations to multiply a sparse matrix by a diagonal matrix.

* Fixed up some bugs in shift_diag macros.

* Fix up fortran interface to handle pointers correctly.

* Capture latest changes to matrix-matrix multiply routine. Currently compiles but
not tested to see if it works.

* Added matrix-matrix multiply operation to sparse array library.

* Modified code so that buffers for matrix-matrix multiply are preallocated. This
eliminates the need to keep resizing buffers on the fly.

* Fixed bug in add element routine that was not correctly resizing arrays.

* Fixed up some additional bugs with temporary arrays for holding sparse array indices.

* Added fixes to sparse matrix-matrix multiply operation.

* Added functionality to extract column from sparse matrix.

* Fixed up count_sketch function and added test for it to sprs_test.c

* Added Mersenne twister to build files, fixed up sparse array export module and
added some minor bug fixes.

* Checking in some fixes for linear arrays and capturing current state of random
Gram-Schmidt orthogonalization code.

* Added new functionality for mixed sparse-dense operations.

* Added synchronization and mask variables to all global operations.

* fix NGA_Sprs_array_access_col_block64 definition

* [cmake] new routines for sparse arrays

* Fixed up a few problem so that test suite runs.

* Added sparse to dense conversion routine to sparse matrix api.

* Fixed up some problems after rebasing branch.

---------

Co-authored-by: bjpalmer <d3g293@prusik.pnl.gov>
Co-authored-by: Bruce J Palmer <d3g293@constance04.pnl.gov>
Co-authored-by: Bruce J Palmer <d3g293@constance-e.pnl.gov>
Co-authored-by: Bruce J Palmer <d3g293@constance03.pnl.gov>
Co-authored-by: Bruce J Palmer <d3g293@constance01.pnl.gov>
Co-authored-by: Bruce J Palmer <d3g293@deception03.pnl.gov>
Co-authored-by: Bruce J Palmer <d3g293@deception01.pnl.gov>
Co-authored-by: Palmer <d3g293@we36220.pnl.gov>
Co-authored-by: Ajay Panyala <ajay.panyala@gmail.com>
Co-authored-by: edoapra <edoardo.apra@gmail.com>
Co-authored-by: Bruce J Palmer <d3g293@deception02.pnl.gov>
  • Loading branch information
12 people authored Dec 5, 2024
1 parent 6bc1d51 commit 816e015
Show file tree
Hide file tree
Showing 25 changed files with 12,003 additions and 39 deletions.
27 changes: 26 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ CLEANFILES += global/src/ga-wapidefs.h
libga_la_SOURCES += global/src/abstract_ops.h
libga_la_SOURCES += global/src/base.c
libga_la_SOURCES += global/src/base.h
libga_la_SOURCES += global/src/iterator.h
libga_la_SOURCES += global/src/ga_iterator.h
libga_la_SOURCES += global/src/ga_sparse.array.h
libga_la_SOURCES += global/src/capi.c
libga_la_SOURCES += global/src/cnames.h
libga_la_SOURCES += global/src/collect.c
Expand All @@ -392,6 +393,10 @@ libga_la_SOURCES += global/src/globalp.h
libga_la_SOURCES += global/src/global.util.c
libga_la_SOURCES += global/src/hsort.scat.c
libga_la_SOURCES += global/src/iterator.c
libga_la_SOURCES += global/src/sparse.array.c
libga_la_SOURCES += global/src/sketch.c
libga_la_SOURCES += global/src/mtwister.h
libga_la_SOURCES += global/src/mtwister.c
libga_la_SOURCES += global/src/matmul.c
libga_la_SOURCES += global/src/matmul.h
libga_la_SOURCES += global/src/matrix.c
Expand Down Expand Up @@ -442,6 +447,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/global/src
AM_CPPFLAGS += -I$(top_srcdir)/global/testing

check_PROGRAMS += global/testing/big
check_PROGRAMS += global/testing/rand
check_PROGRAMS += global/testing/elempatch
check_PROGRAMS += global/testing/tiled_irreg_test
check_PROGRAMS += global/testing/gatscat
Expand All @@ -462,6 +468,12 @@ check_PROGRAMS += global/testing/scan_addc
check_PROGRAMS += global/testing/scan_copyc
check_PROGRAMS += global/testing/sprsmatvec
check_PROGRAMS += global/testing/testabstract_ops
check_PROGRAMS += global/testing/testsparse
check_PROGRAMS += global/testing/laplace
check_PROGRAMS += global/testing/sprs_test
check_PROGRAMS += global/testing/kaczmarz
check_PROGRAMS += global/testing/j_iter
#check_PROGRAMS += global/testing/gs_ran
check_PROGRAMS += global/testing/testc
check_PROGRAMS += global/testing/testmatmultc
check_PROGRAMS += global/testing/testmult
Expand Down Expand Up @@ -640,6 +652,7 @@ GLOBAL_PARALLEL_TESTS += global/testing/tiled_irreg_test$(EXEEXT)
#GLOBAL_PARALLEL_TESTS += global/testing/gatscat$(EXEEXT) # broken
GLOBAL_PARALLEL_TESTS += global/testing/comm_init$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/getmem$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/rand$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/mtest$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/mulmatpatchc$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/normc$(EXEEXT)
Expand All @@ -653,6 +666,11 @@ GLOBAL_PARALLEL_TESTS += global/testing/print$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/scan_addc$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/scan_copyc$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/testc$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/laplace$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/sprs_test$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/kaczmarz$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/j_iter$(EXEEXT)
#GLOBAL_PARALLEL_TESTS += global/testing/gs_ran$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/testmatmultc$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/testmult$(EXEEXT)
GLOBAL_PARALLEL_TESTS += global/testing/testmultrect$(EXEEXT)
Expand Down Expand Up @@ -927,9 +945,16 @@ global_testing_pgtestmatmult_SOURCES = global/testing/pgtestmatmult.F $(gt
global_testing_print_SOURCES = global/testing/print.c
global_testing_random_SOURCES = global/testing/random.F $(gtsrcf)
global_testing_scan_SOURCES = global/testing/scan.F $(gtsrcf)
global_testing_rand_SOURCES = global/testing/rand.c
global_testing_scan_addc_SOURCES = global/testing/scan_addc.c
global_testing_scan_copyc_SOURCES = global/testing/scan_copyc.c
global_testing_sprsmatvec_SOURCES = global/testing/sprsmatvec.c
global_testing_testsparse_SOURCES = global/testing/testsparse.c
global_testing_laplace_SOURCES = global/testing/laplace.c
global_testing_sprs_test_SOURCES = global/testing/sprs_test.c
global_testing_kaczmarz_SOURCES = global/testing/kaczmarz.c
global_testing_j_iter_SOURCES = global/testing/j_iter.c
#global_testing_gs_ran_SOURCES = global/testing/gs_ran.c
global_testing_simple_groups_SOURCES = global/testing/simple_groups.F $(gtsrcf)
global_testing_simple_groups_comm_SOURCES = global/testing/simple_groups_comm.F $(gtsrcf)
global_testing_simple_groups_commc_SOURCES = global/testing/simple_groups_commc.c
Expand Down
4 changes: 4 additions & 0 deletions global/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ set(GA_FILES
sclstubs.c
select.c
sparse.c
sparse.array.c
sketch.c
mtwister.c

${GA_FORTRAN_INTERFACE_C_FILES}
${GA_FORTRAN_INTERFACE_F_FILES}
)
Expand Down
36 changes: 32 additions & 4 deletions global/src/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include "ga-papi.h"
#include "ga-wapi.h"
#include "thread-safe.h"
#include "mtwister.h"

static int calc_maplen(int handle);

Expand Down Expand Up @@ -114,6 +115,8 @@ int GA_Default_Proc_Group = -1;
int ga_armci_world_group=0;
int GA_Init_Proc_Group = -2;
Integer GA_Debug_flag = 0;
static Integer GA_Rand_seed = -1;
static MTRand GA_Rand;

/* MA addressing */
DoubleComplex *DCPL_MB; /* double precision complex base address */
Expand Down Expand Up @@ -156,6 +159,8 @@ int gai_getmem(char* name, char **ptr_arr, C_Long bytes, int type, long *id,
int grp_id);
int gai_get_devmem(char *name, char **ptr_arr, C_Long bytes, int type, long *adj,
int grp_id, int dev_flag, const char *device);
extern void sai_init_sparse_arrays();
extern void sai_terminate_sparse_arrays();
#ifdef ENABLE_CHECKPOINT
static int ga_group_is_for_ft=0;
int ga_spare_procs;
Expand Down Expand Up @@ -517,6 +522,7 @@ void pnga_initialize()
comm = GA_MPI_Comm_pgroup(-1);
MPI_Comm_dup(comm, &GA_MPI_World_comm_dup);
#endif
sai_init_sparse_arrays();
GA_Internal_Threadsafe_Unlock();
}

Expand Down Expand Up @@ -724,6 +730,7 @@ int candidate, found, b; \
C_Integer *map= (map_ij);\
\
candidate = (int)(scale*(elem));\
if (candidate == (n)) candidate = (n)-1; \
found = 0;\
if(map[candidate] <= (elem)){ /* search upward */\
b= candidate;\
Expand Down Expand Up @@ -1737,15 +1744,15 @@ void pnga_set_irreg_distr(Integer g_a, Integer *mapc, Integer *nblock)
maplen = 0;
for (i=0; i<GA[ga_handle].ndim; i++) {
ichk = mapc[maplen];
if (ichk < 1 || ichk > GA[ga_handle].dims[i])
if (ichk < 1 || ichk > GA[ga_handle].dims[i]+1)
pnga_error("Mapc entry outside array dimension limits",ichk);
maplen++;
for (j=1; j<nblock[i]; j++) {
if (mapc[maplen] < ichk) {
pnga_error("Mapc entries are not properly monotonic",ichk);
}
ichk = mapc[maplen];
if (ichk < 1 || ichk > GA[ga_handle].dims[i])
if (ichk < 1 || ichk > GA[ga_handle].dims[i]+1)
pnga_error("Mapc entry outside array dimension limits",ichk);
maplen++;
}
Expand Down Expand Up @@ -1923,15 +1930,15 @@ void pnga_set_tiled_irreg_proc_grid(Integer g_a, Integer *mapc, Integer *nblocks
maplen = 0;
for (i=0; i<GA[ga_handle].ndim; i++) {
ichk = mapc[maplen];
if (ichk < 1 || ichk > GA[ga_handle].dims[i])
if (ichk < 1 || ichk > GA[ga_handle].dims[i]+1)
pnga_error("Mapc entry outside array dimension limits",ichk);
maplen++;
for (j=1; j<nblocks[i]; j++) {
if (mapc[maplen] < ichk) {
pnga_error("Mapc entries are not properly monotonic",ichk);
}
ichk = mapc[maplen];
if (ichk < 1 || ichk > GA[ga_handle].dims[i])
if (ichk < 1 || ichk > GA[ga_handle].dims[i]+1)
pnga_error("Mapc entry outside array dimension limits",ichk);
maplen++;
}
Expand Down Expand Up @@ -4166,6 +4173,7 @@ Integer i, handle;
return;
}

sai_terminate_sparse_arrays();
#ifdef PROFILE_OLD
ga_profile_terminate();
#endif
Expand Down Expand Up @@ -5902,3 +5910,23 @@ void pnga_version(Integer *major_version, Integer *minor_version, Integer *patch
*minor_version = GA_VERSION_MINOR;
*patch = GA_VERSION_PATCH;
}

#if HAVE_SYS_WEAK_ALIAS_PRAGMA
# pragma weak wnga_rand = pnga_rand
#endif
double pnga_rand(Integer iseed)
{
double ret;
if (GA_Rand_seed == -1) {
unsigned long lseed;
/* Choose a value for iseed if it has not already been set */
if (iseed == 0) {
iseed = 121238;
}
lseed = (unsigned long)(abs(iseed));
GA_Rand = seedRand(lseed);
GA_Rand_seed = 0;
}
ret = genRand(&GA_Rand);
return ret;
}
Loading

0 comments on commit 816e015

Please sign in to comment.