Skip to content

Commit

Permalink
fixed various bugs, race conditions, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrikeyang committed Mar 4, 2019
1 parent 84d5010 commit 97cd175
Show file tree
Hide file tree
Showing 44 changed files with 1,558 additions and 422 deletions.
8 changes: 4 additions & 4 deletions src/IJ_mv/HYPRE_IJMatrix.c
Expand Up @@ -1066,7 +1066,7 @@ HYPRE_IJMatrixRead( const char *filename,
return hypre_error_flag;
}

hypre_fscanf(file, "%d %d %d %d", &ilower, &iupper, &jlower, &jupper);
hypre_fscanf(file, "%b %b %b %b", &ilower, &iupper, &jlower, &jupper);
HYPRE_IJMatrixCreate(comm, ilower, iupper, jlower, jupper, &matrix);

HYPRE_IJMatrixSetObjectType(matrix, type);
Expand All @@ -1075,7 +1075,7 @@ HYPRE_IJMatrixRead( const char *filename,
/* It is important to ensure that whitespace follows the index value to help
* catch mistakes in the input file. See comments in IJVectorRead(). */
ncols = 1;
while ( (ret = hypre_fscanf(file, "%d %d%*[ \t]%le", &I, &J, &value)) != EOF )
while ( (ret = hypre_fscanf(file, "%b %b%*[ \t]%le", &I, &J, &value)) != EOF )
{
if (ret != 3)
{
Expand Down Expand Up @@ -1158,7 +1158,7 @@ HYPRE_IJMatrixPrint( HYPRE_IJMatrix matrix,
jlower = col_partitioning[myid];
jupper = col_partitioning[myid+1] - 1;
#endif
hypre_fprintf(file, "%d %d %d %d\n", ilower, iupper, jlower, jupper);
hypre_fprintf(file, "%b %b %b %b\n", ilower, iupper, jlower, jupper);

HYPRE_IJMatrixGetObject(matrix, &object);

Expand All @@ -1185,7 +1185,7 @@ HYPRE_IJMatrixPrint( HYPRE_IJMatrix matrix,

for (j = 0; j < ncols; j++)
{
hypre_fprintf(file, "%d %d %.14e\n", i, cols[j], values[j]);
hypre_fprintf(file, "%b %b %.14e\n", i, cols[j], values[j]);
}

if ( hypre_IJMatrixObjectType(matrix) == HYPRE_PARCSR )
Expand Down
8 changes: 4 additions & 4 deletions src/IJ_mv/HYPRE_IJVector.c
Expand Up @@ -549,7 +549,7 @@ HYPRE_IJVectorRead( const char *filename,
return hypre_error_flag;
}

hypre_fscanf(file, "%d %d", &jlower, &jupper);
hypre_fscanf(file, "%b %b", &jlower, &jupper);
HYPRE_IJVectorCreate(comm, jlower, jupper, &vector);

HYPRE_IJVectorSetObjectType(vector, type);
Expand All @@ -559,7 +559,7 @@ HYPRE_IJVectorRead( const char *filename,
* catch mistakes in the input file. This is done with %*[ \t]. Using a
* space here causes an input line with a single decimal value on it to be
* read as if it were an integer followed by a decimal value. */
while ( (ret = hypre_fscanf(file, "%d%*[ \t]%le", &j, &value)) != EOF )
while ( (ret = hypre_fscanf(file, "%b%*[ \t]%le", &j, &value)) != EOF )
{
if (ret != 2)
{
Expand Down Expand Up @@ -622,13 +622,13 @@ HYPRE_IJVectorPrint( HYPRE_IJVector vector,
jlower = partitioning[myid];
jupper = partitioning[myid+1] - 1;
#endif
hypre_fprintf(file, "%d %d\n", jlower, jupper);
hypre_fprintf(file, "%b %b\n", jlower, jupper);

for (j = jlower; j <= jupper; j++)
{
HYPRE_IJVectorGetValues(vector, 1, &j, &value);

hypre_fprintf(file, "%d %.14e\n", j, value);
hypre_fprintf(file, "%b %.14e\n", j, value);
}

fclose(file);
Expand Down
62 changes: 31 additions & 31 deletions src/IJ_mv/IJMatrix_parcsr.c
Expand Up @@ -413,7 +413,7 @@ HYPRE_Int hypre_IJMatrixGetRowCountsParCSR( hypre_IJMatrix *matrix,
ncols[i] = 0;
if (print_level)
{
hypre_printf ("Warning! Row %d is not on Proc. %d!\n",
hypre_printf ("Warning! Row %b is not on Proc. %d!\n",
row_index, my_id);
}
}
Expand Down Expand Up @@ -555,7 +555,7 @@ hypre_IJMatrixGetValuesParCSR( hypre_IJMatrix *matrix,
{
if (print_level)
{
hypre_printf ("Warning! Row %d is not on Proc. %d!\n", row, my_id);
hypre_printf ("Warning! Row %b is not on Proc. %d!\n", row, my_id);
}
}
}
Expand Down Expand Up @@ -622,7 +622,7 @@ hypre_IJMatrixGetValuesParCSR( hypre_IJMatrix *matrix,
{
if (print_level)
{
hypre_printf ("Warning! Row %d is not on Proc. %d!\n", row, my_id);
hypre_printf ("Warning! Row %b is not on Proc. %d!\n", row, my_id);
}
}
}
Expand Down Expand Up @@ -761,7 +761,7 @@ hypre_IJMatrixSetValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" row %d too long! \n", row);
hypre_printf (" row %b too long! \n", row);
}
return hypre_error_flag;
}
Expand All @@ -784,7 +784,7 @@ hypre_IJMatrixSetValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
return hypre_error_flag;
Expand All @@ -803,7 +803,7 @@ hypre_IJMatrixSetValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
return hypre_error_flag;
Expand All @@ -818,7 +818,7 @@ hypre_IJMatrixSetValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
/* return -1;*/
Expand All @@ -842,7 +842,7 @@ hypre_IJMatrixSetValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
/* return -1; */
Expand Down Expand Up @@ -1004,7 +1004,7 @@ hypre_IJMatrixSetValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf("Error in row %d ! Too many elements!\n",
hypre_printf("Error in row %b ! Too many elements!\n",
row);
}
/* return 1; */
Expand Down Expand Up @@ -1037,7 +1037,7 @@ hypre_IJMatrixSetValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf("Error in row %d ! Too many elements !\n",
hypre_printf("Error in row %b ! Too many elements !\n",
row);
}
/* return 1; */
Expand Down Expand Up @@ -1232,7 +1232,7 @@ hypre_IJMatrixAddToValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" row %d too long! \n", row);
hypre_printf (" row %b too long! \n", row);
}
return hypre_error_flag;
}
Expand All @@ -1255,7 +1255,7 @@ hypre_IJMatrixAddToValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
return hypre_error_flag;
Expand All @@ -1275,7 +1275,7 @@ hypre_IJMatrixAddToValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
return hypre_error_flag;
Expand All @@ -1290,7 +1290,7 @@ hypre_IJMatrixAddToValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
return hypre_error_flag;
Expand All @@ -1313,7 +1313,7 @@ hypre_IJMatrixAddToValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
return hypre_error_flag;
Expand Down Expand Up @@ -1536,7 +1536,7 @@ hypre_IJMatrixAddToValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf("Error in row %d ! Too many elements!\n",
hypre_printf("Error in row %b ! Too many elements!\n",
row);
}
/* return 1;*/
Expand Down Expand Up @@ -1570,7 +1570,7 @@ hypre_IJMatrixAddToValuesParCSR( hypre_IJMatrix *matrix,
hypre_error(HYPRE_ERROR_GENERIC);
if (print_level)
{
hypre_printf("Error in row %d ! Too many elements !\n",
hypre_printf("Error in row %b ! Too many elements !\n",
row);
}
/* return 1; */
Expand Down Expand Up @@ -3197,7 +3197,7 @@ hypre_IJMatrixSetValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" row %d too long! \n", row);
hypre_printf (" row %b too long! \n", row);
}
break;
/*return hypre_error_flag; */
Expand Down Expand Up @@ -3225,7 +3225,7 @@ hypre_IJMatrixSetValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
break;
Expand All @@ -3249,7 +3249,7 @@ hypre_IJMatrixSetValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
break;
Expand All @@ -3269,7 +3269,7 @@ hypre_IJMatrixSetValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
break;
Expand Down Expand Up @@ -3297,7 +3297,7 @@ hypre_IJMatrixSetValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
break;
Expand Down Expand Up @@ -3555,7 +3555,7 @@ hypre_IJMatrixSetValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf("Error in row %d ! Too many elements!\n",
hypre_printf("Error in row %b ! Too many elements!\n",
row);
}
break;
Expand Down Expand Up @@ -3591,7 +3591,7 @@ hypre_IJMatrixSetValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf("Error in row %d ! Too many elements !\n",
hypre_printf("Error in row %b ! Too many elements !\n",
row);
}
break;
Expand Down Expand Up @@ -3828,7 +3828,7 @@ hypre_IJMatrixAddToValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" row %d too long! \n", row);
hypre_printf (" row %b too long! \n", row);
}
break;
/*return hypre_error_flag; */
Expand Down Expand Up @@ -3856,7 +3856,7 @@ hypre_IJMatrixAddToValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
break;
Expand All @@ -3880,7 +3880,7 @@ hypre_IJMatrixAddToValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
break;
Expand All @@ -3900,7 +3900,7 @@ hypre_IJMatrixAddToValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
break;
Expand Down Expand Up @@ -3928,7 +3928,7 @@ hypre_IJMatrixAddToValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf (" Error, element %d %d does not exist\n",
hypre_printf (" Error, element %b %b does not exist\n",
row, cols[indx]);
}
break;
Expand Down Expand Up @@ -4171,7 +4171,7 @@ hypre_IJMatrixAddToValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf("Error in row %d ! Too many elements!\n",
hypre_printf("Error in row %b ! Too many elements!\n",
row);
}
break;
Expand Down Expand Up @@ -4207,7 +4207,7 @@ hypre_IJMatrixAddToValuesOMPParCSR( hypre_IJMatrix *matrix,
error_flag++;
if (print_level)
{
hypre_printf("Error in row %d ! Too many elements !\n",
hypre_printf("Error in row %b ! Too many elements !\n",
row);
}
break;
Expand Down
4 changes: 2 additions & 2 deletions src/config/HYPRE_config.h.cmake.in
Expand Up @@ -17,10 +17,10 @@
#define HYPRE_RELEASE_BUGS "@HYPRE_BUGS@"

/* Use long long int for HYPRE_BigInt */
#cmakedefine HYPRE_BIGINT
#cmakedefine HYPRE_MIXEDINT

/* Use long long int for HYPRE_BigInt and HYPRE_Int*/
#cmakedefine HYPRE_ALLBIGINT
#cmakedefine HYPRE_BIGINT

/* Use single precision values for HYPRE_Real */
#cmakedefine HYPRE_SINGLE
Expand Down
4 changes: 2 additions & 2 deletions src/config/HYPRE_config.h.in
Expand Up @@ -47,10 +47,10 @@
#undef HYPRE_IRIX64

/* Define to 1 if using long long int for HYPRE_BigInt */
#undef HYPRE_BIGINT
#undef HYPRE_MIXEDINT

/* Define to 1 if using long long int for HYPRE_Int and HYPRE_BigInt */
#undef HYPRE_ALLBIGINT
#undef HYPRE_BIGINT

/* Define to 1 if using single precision values for HYPRE_Real */
#undef HYPRE_SINGLE
Expand Down

0 comments on commit 97cd175

Please sign in to comment.