Skip to content

Commit

Permalink
Bug fix: in "dReDistributre_A", dereference several uninitialized/una…
Browse files Browse the repository at this point in the history
…llocated arrays even though their sizes are zero.

Upgrade to v7.1.1
  • Loading branch information
xiaoyeli committed Oct 18, 2021
1 parent e3eba61 commit 0017a2e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cmake_minimum_required(VERSION 3.18.1 FATAL_ERROR)
project(SuperLU_DIST C CXX)
set(VERSION_MAJOR "7")
set(VERSION_MINOR "1")
set(VERSION_BugFix "0")
set(VERSION_BugFix "1")
set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BugFix})

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SuperLU_DIST (version 7.1.0) <img align=center width="55" alt="superlu" src="https://user-images.githubusercontent.com/11741943/103982988-5a9a9d00-5139-11eb-9ac4-a55e80a79f8d.png">
# SuperLU_DIST (version 7.1.1) <img align=center width="55" alt="superlu" src="https://user-images.githubusercontent.com/11741943/103982988-5a9a9d00-5139-11eb-9ac4-a55e80a79f8d.png">

[![Build Status](https://travis-ci.org/xiaoyeli/superlu_dist.svg?branch=master)](https://travis-ci.org/xiaoyeli/superlu_dist)
[Nightly tests](http://my.cdash.org/index.php?project=superlu_dist)
Expand All @@ -25,7 +25,7 @@ acceleration capabilities.
Table of Contents
=================

* [SuperLU_DIST (version 7.1.0) <a href="https://user-images.githubusercontent.com/11741943/103982988-5a9a9d00-5139-11eb-9ac4-a55e80a79f8d.png" target="_blank" rel="nofollow"><img align="center" width="55" alt="superlu" src="https://user-images.githubusercontent.com/11741943/103982988-5a9a9d00-5139-11eb-9ac4-a55e80a79f8d.png" style="max-width:100%;"></a>](#superlu_dist-version-70---)
* [SuperLU_DIST (version 7.1.1) <a href="https://user-images.githubusercontent.com/11741943/103982988-5a9a9d00-5139-11eb-9ac4-a55e80a79f8d.png" target="_blank" rel="nofollow"><img align="center" width="55" alt="superlu" src="https://user-images.githubusercontent.com/11741943/103982988-5a9a9d00-5139-11eb-9ac4-a55e80a79f8d.png" style="max-width:100%;"></a>](#superlu_dist-version-70---)
* [Directory structure of the source code](#directory-structure-of-the-source-code)
* [Installation](#installation)
* [Installation option 1: Using CMake build system.](#installation-option-1-using-cmake-build-system)
Expand Down
21 changes: 11 additions & 10 deletions SRC/pddistribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ at the top-level directory.
/*! @file
* \brief Re-distribute A on the 2D process mesh.
* <pre>
* -- Distributed SuperLU routine (version 2.3) --
* -- Distributed SuperLU routine (version 7.1.1) --
* Lawrence Berkeley National Lab, Univ. of California Berkeley.
* October 15, 2008
* October 18, 2021, minor fix, v7.1.1
* </pre>
*/

Expand Down Expand Up @@ -141,8 +142,8 @@ dReDistribute_A(SuperMatrix *A, dScalePermstruct_t *ScalePermstruct,
ABORT("Malloc fails for ia[].");
if ( !(aij = doubleMalloc_dist(k)) )
ABORT("Malloc fails for aij[].");
ja = ia + k;
}
ja = ia + k;

/* Allocate temporary storage for sending/receiving the A triplets. */
if ( procs > 1 ) {
Expand Down Expand Up @@ -170,9 +171,9 @@ dReDistribute_A(SuperMatrix *A, dScalePermstruct_t *ScalePermstruct,

for (i = 0, j = 0, p = 0; p < procs; ++p) {
if ( p != iam ) {
ia_send[p] = &index[i];
if (nnzToSend[p] > 0) ia_send[p] = &index[i];
i += 2 * nnzToSend[p]; /* ia/ja indices alternate */
aij_send[p] = &nzval[j];
if (nnzToSend[p] > 0) aij_send[p] = &nzval[j];
j += nnzToSend[p];
}
}
Expand Down Expand Up @@ -216,8 +217,8 @@ dReDistribute_A(SuperMatrix *A, dScalePermstruct_t *ScalePermstruct,
NOTE: Can possibly use MPI_Alltoallv.
------------------------------------------------------------*/
for (p = 0; p < procs; ++p) {
if ( p != iam && nnzToSend[p]>0 ) { // cause two of the tests to hang
// if ( p != iam ) {
if ( p != iam && nnzToSend[p] > 0 ) {
//if ( p != iam ) {
it = 2*nnzToSend[p];
MPI_Isend( ia_send[p], it, mpi_int_t,
p, iam, grid->comm, &send_req[p] );
Expand All @@ -228,8 +229,8 @@ dReDistribute_A(SuperMatrix *A, dScalePermstruct_t *ScalePermstruct,
}

for (p = 0; p < procs; ++p) {
if ( p != iam && nnzToRecv[p]>0 ) {
//if ( p != iam ) {
if ( p != iam && nnzToRecv[p] > 0 ) {
//if ( p != iam ) {
it = 2*nnzToRecv[p];
MPI_Recv( itemp, it, mpi_int_t, p, p, grid->comm, &status );
it = nnzToRecv[p];
Expand All @@ -248,8 +249,8 @@ dReDistribute_A(SuperMatrix *A, dScalePermstruct_t *ScalePermstruct,
}

for (p = 0; p < procs; ++p) {
if ( p != iam && nnzToSend[p] > 0 ) {
//if ( p != iam ) {
if ( p != iam && nnzToSend[p] > 0 ) { // cause two of the tests to hang
//if ( p != iam ) {
MPI_Wait( &send_req[p], &status);
MPI_Wait( &send_req[procs+p], &status);
}
Expand Down
9 changes: 5 additions & 4 deletions SRC/psdistribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ at the top-level directory.
/*! @file
* \brief Re-distribute A on the 2D process mesh.
* <pre>
* -- Distributed SuperLU routine (version 2.3) --
* -- Distributed SuperLU routine (version 7.1.1) --
* Lawrence Berkeley National Lab, Univ. of California Berkeley.
* October 15, 2008
* October 18, 2021, minor fix, v7.1.1
* </pre>
*/

Expand Down Expand Up @@ -141,8 +142,8 @@ sReDistribute_A(SuperMatrix *A, sScalePermstruct_t *ScalePermstruct,
ABORT("Malloc fails for ia[].");
if ( !(aij = floatMalloc_dist(k)) )
ABORT("Malloc fails for aij[].");
ja = ia + k;
}
ja = ia + k;

/* Allocate temporary storage for sending/receiving the A triplets. */
if ( procs > 1 ) {
Expand Down Expand Up @@ -170,9 +171,9 @@ sReDistribute_A(SuperMatrix *A, sScalePermstruct_t *ScalePermstruct,

for (i = 0, j = 0, p = 0; p < procs; ++p) {
if ( p != iam ) {
ia_send[p] = &index[i];
if (nnzToSend[p] > 0) ia_send[p] = &index[i];
i += 2 * nnzToSend[p]; /* ia/ja indices alternate */
aij_send[p] = &nzval[j];
if (nnzToSend[p] > 0) aij_send[p] = &nzval[j];
j += nnzToSend[p];
}
}
Expand Down
21 changes: 11 additions & 10 deletions SRC/pzdistribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ at the top-level directory.
/*! @file
* \brief Re-distribute A on the 2D process mesh.
* <pre>
* -- Distributed SuperLU routine (version 2.3) --
* -- Distributed SuperLU routine (version 7.1.1) --
* Lawrence Berkeley National Lab, Univ. of California Berkeley.
* October 15, 2008
* October 18, 2021, minor fix, v7.1.1
* </pre>
*/

Expand Down Expand Up @@ -140,8 +141,8 @@ zReDistribute_A(SuperMatrix *A, zScalePermstruct_t *ScalePermstruct,
ABORT("Malloc fails for ia[].");
if ( !(aij = doublecomplexMalloc_dist(k)) )
ABORT("Malloc fails for aij[].");
ja = ia + k;
}
ja = ia + k;

/* Allocate temporary storage for sending/receiving the A triplets. */
if ( procs > 1 ) {
Expand Down Expand Up @@ -169,9 +170,9 @@ zReDistribute_A(SuperMatrix *A, zScalePermstruct_t *ScalePermstruct,

for (i = 0, j = 0, p = 0; p < procs; ++p) {
if ( p != iam ) {
ia_send[p] = &index[i];
if (nnzToSend[p] > 0) ia_send[p] = &index[i];
i += 2 * nnzToSend[p]; /* ia/ja indices alternate */
aij_send[p] = &nzval[j];
if (nnzToSend[p] > 0) aij_send[p] = &nzval[j];
j += nnzToSend[p];
}
}
Expand Down Expand Up @@ -215,8 +216,8 @@ zReDistribute_A(SuperMatrix *A, zScalePermstruct_t *ScalePermstruct,
NOTE: Can possibly use MPI_Alltoallv.
------------------------------------------------------------*/
for (p = 0; p < procs; ++p) {
if ( p != iam && nnzToSend[p] > 0 ) {
//if ( p != iam ) {
if ( p != iam && nnzToSend[p] > 0 ) {
//if ( p != iam ) {
it = 2*nnzToSend[p];
MPI_Isend( ia_send[p], it, mpi_int_t,
p, iam, grid->comm, &send_req[p] );
Expand All @@ -227,8 +228,8 @@ zReDistribute_A(SuperMatrix *A, zScalePermstruct_t *ScalePermstruct,
}

for (p = 0; p < procs; ++p) {
if ( p != iam && nnzToRecv[p] > 0 ) {
//if ( p != iam ) {
if ( p != iam && nnzToRecv[p] > 0 ) {
//if ( p != iam ) {
it = 2*nnzToRecv[p];
MPI_Recv( itemp, it, mpi_int_t, p, p, grid->comm, &status );
it = nnzToRecv[p];
Expand All @@ -247,8 +248,8 @@ zReDistribute_A(SuperMatrix *A, zScalePermstruct_t *ScalePermstruct,
}

for (p = 0; p < procs; ++p) {
if ( p != iam && nnzToSend[p] > 0 ) {
//if ( p != iam ) {
if ( p != iam && nnzToSend[p] > 0 ) { // cause two of the tests to hang
//if ( p != iam ) {
MPI_Wait( &send_req[p], &status);
MPI_Wait( &send_req[procs+p], &status);
}
Expand Down
5 changes: 3 additions & 2 deletions SRC/superlu_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ at the top-level directory.
* October 23, 2020 version 6.4.0
* May 12, 2021 version 7.0.0
* October 5, 2021 version 7.1.0
* October 18, 2021 version 7.1.1
* </pre>
*/

Expand Down Expand Up @@ -76,8 +77,8 @@ at the top-level directory.
*/
#define SUPERLU_DIST_MAJOR_VERSION 7
#define SUPERLU_DIST_MINOR_VERSION 1
#define SUPERLU_DIST_PATCH_VERSION 0
#define SUPERLU_DIST_RELEASE_DATE "October 5, 2021"
#define SUPERLU_DIST_PATCH_VERSION 1
#define SUPERLU_DIST_RELEASE_DATE "October 18, 2021"

#include "superlu_dist_config.h"
/* Define my integer size int_t */
Expand Down

0 comments on commit 0017a2e

Please sign in to comment.