Skip to content

Commit

Permalink
Extra warnings added and fixes to make them clear (#223)
Browse files Browse the repository at this point in the history
* Extra warnings added and fixes to make them clear

Credit to ChatGPT

* Make comm parameters intent in

* A few more places

* Remove ' from comments, because that's apparently a thing...

* More places with '

* Turn off Werror

Apparently the version of gfortran on github CI is so absurdly broken
that it gives a warning about C++ style comments in a Fortran file...

* I think my build conditionals are wrong

* Maybe we need to reduce the number of threads, CI is slow

* Simplify thread setting

* typo
  • Loading branch information
william-dawson authored Nov 15, 2023
1 parent 37426fb commit 95b3ba3
Show file tree
Hide file tree
Showing 23 changed files with 92 additions and 84 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
debug: 0
noalligather: 0
mpich: 0
threadoff: 0
numthread: 1
elsi: 0
- name: ubuntu-debug
os: ubuntu-latest
Expand All @@ -27,7 +27,7 @@ jobs:
debug: 1
noalligather: 0
mpich: 0
threadoff: 0
numthread: 1
elsi: 0
- name: ubuntu-nogather
os: ubuntu-latest
Expand All @@ -37,7 +37,7 @@ jobs:
debug: 0
noalligather: 1
mpich: 0
threadoff: 0
numthread: 1
elsi: 0
- name: ubuntu-mpich
os: ubuntu-latest
Expand All @@ -47,7 +47,7 @@ jobs:
debug: 0
noalligather: 0
mpich: 1
threadoff: 0
numthread: 3
elsi: 0
- name: mac-thread-cap
os: macos-latest
Expand All @@ -57,7 +57,7 @@ jobs:
debug: 0
noalligather: 0
mpich: 0
threadoff: 1
numthread: 3
elsi: 0
- name: mac
os: macos-latest
Expand All @@ -68,7 +68,7 @@ jobs:
noalligather: 0
mpich: 0
lint: 1
threadoff: 0
numthread: 3
elsi: 1
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -92,7 +92,7 @@ jobs:
env:
MAKETEST: ${{ matrix.maketest }}
TESTOS: ${{ matrix.testos }}
THREADOFF: ${{ matrix.threadoff }}
OMP_NUM_THREADS: ${{ matrix.numthread }}
- name: check examples
run: |
bash -l UnitTests/check_examples.sh
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
################################################################################
## Basic Setup
cmake_minimum_required (VERSION 3.9)
project(NTPoly VERSION 2.7.0 DESCRIPTION
project(NTPoly VERSION 3.1.0 DESCRIPTION
"A parallel library for computing the functions of sparse matrices")
enable_language(Fortran)

Expand Down
4 changes: 2 additions & 2 deletions Source/C/TripletList_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void AppendToTripletList_r_wrp(int *ih_this, const int *index_column,
void SetTripletAt_r_wrp(int *ih_this, const int *index, const int *index_column,
const int *index_row, const double *point_value);
void GetTripletAt_r_wrp(const int *ih_this, const int *index, int *index_column,
const int *index_row, double *point_value);
int *index_row, double *point_value);
void DestructTripletList_r_wrp(int *ih_this);
void SortTripletList_r_wrp(const int *ih_this, const int *matrix_size,
int *h_sorted);
Expand All @@ -24,7 +24,7 @@ void SetTripletAt_c_wrp(int *ih_this, const int *index, const int *index_column,
const int *index_row, const double *point_value_real,
const double *point_value_imag);
void GetTripletAt_c_wrp(const int *ih_this, const int *index, int *index_column,
const int *index_row, const double *point_value_real,
int *index_row, const double *point_value_real,
const double *point_value_imag);
void DestructTripletList_c_wrp(int *ih_this);
void SortTripletList_c_wrp(const int *ih_this, const int *matrix_size,
Expand Down
2 changes: 1 addition & 1 deletion Source/CPlusPlus/EigenBounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Matrix_ps;
class EigenBounds : public SolverBase {
public:
//! Compute a bounds on the minimum and maximum eigenvalue of a matrix.
//! Uses Gershgorin's theorem.
//! Uses Gershgorin theorem.
//!\param matrix the matrix to compute the min/max of.
//!\param min_ger_eig a lower bound on the eigenspectrum.
//!\param max_ger_eig an uppder bound on the eigenspectrum.
Expand Down
4 changes: 2 additions & 2 deletions Source/CPlusPlus/InverseSolvers.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Matrix_ps;
class InverseSolvers : public SolverBase {
public:
//! Compute the inverse of a matrix.
//! An implementation of Hotelling's method.
//! An implementation of Hotelling method.
//!\param Overlap the matrix to invert.
//!\param InverseMat = Overlap^-1.
//!\param solver_parameters parameters for the solver
Expand All @@ -24,7 +24,7 @@ class InverseSolvers : public SolverBase {
static void DenseInvert(const Matrix_ps &Overlap, Matrix_ps &InverseMat,
const SolverParameters &solver_parameters);
//! Compute the pseudoinverse of a matrix.
//! An implementation of Hotelling's method, with a different convergence
//! An implementation of Hotelling method, with a different convergence
//! criteria.
//!\param Overlap the matrix to invert.
//!\param InverseMat = Overlap^-1.
Expand Down
2 changes: 1 addition & 1 deletion Source/CPlusPlus/Logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void NTPoly::ActivateLogger(bool start_document) {

////////////////////////////////////////////////////////////////////////////////
void NTPoly::ActivateLogger(const string file_name, bool start_document) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
string temp = file_name;
ActivateLoggerFile_wrp(&start_document, &temp.c_str()[0], &string_length);
}
Expand Down
8 changes: 4 additions & 4 deletions Source/CPlusPlus/PSMatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Matrix_ps::Matrix_ps(int matrix_dimension, const ProcessGrid &grid) {

//////////////////////////////////////////////////////////////////////////////
Matrix_ps::Matrix_ps(std::string file_name, bool is_binary) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
if (is_binary) {
ConstructMatrixFromBinary_ps_wrp(ih_this, &file_name.c_str()[0],
&string_length);
Expand All @@ -40,7 +40,7 @@ Matrix_ps::Matrix_ps(std::string file_name, bool is_binary) {
//////////////////////////////////////////////////////////////////////////////
Matrix_ps::Matrix_ps(std::string file_name, const ProcessGrid &grid,
bool is_binary) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
if (is_binary) {
ConstructMatrixFromBinaryPG_ps_wrp(ih_this, &file_name.c_str()[0],
&string_length, grid.ih_this);
Expand All @@ -61,13 +61,13 @@ Matrix_ps::Matrix_ps(const Matrix_ps &matB) {

//////////////////////////////////////////////////////////////////////////////
void Matrix_ps::WriteToBinary(std::string file_name) const {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
WriteMatrixToBinary_ps_wrp(ih_this, &file_name.c_str()[0], &string_length);
}

//////////////////////////////////////////////////////////////////////////////
void Matrix_ps::WriteToMatrixMarket(string file_name) const {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
WriteMatrixToMatrixMarket_ps_wrp(ih_this, &file_name.c_str()[0],
&string_length);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/CPlusPlus/Permutation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ extern "C" {
////////////////////////////////////////////////////////////////////////////////
namespace NTPoly {
////////////////////////////////////////////////////////////////////////////////
Permutation::Permutation(int matrix_dimension) {
Permutation::Permutation(int dimension) {
was_filled = false;
this->matrix_dimension = matrix_dimension;
this->matrix_dimension = dimension;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions Source/CPlusPlus/Polynomial.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ class Polynomial : public SolverBase {
void SetCoefficient(int degree, double coefficient);

public:
//! Compute A Matrix Polynomial Using Horner's Method.
//! Compute A Matrix Polynomial Using Horner Method.
//!\param InputMat input matrix.
//!\param OutputMat = p(InputMat)
//!\param solver_parameters parameters for the solver
void HornerCompute(const Matrix_ps &InputMat, Matrix_ps &OutputMat,
const SolverParameters &solver_parameters) const;
//! Compute A Matrix Polynomial Using Paterson and Stockmeyer's Method.
//! Compute A Matrix Polynomial Using Paterson and Stockmeyer Method.
//!\param InputMat input matrix.
//!\param OutputMat = p(InputMat)
//!\param solver_parameters parameters for the solver
Expand Down
6 changes: 6 additions & 0 deletions Source/CPlusPlus/ProcessGrid.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#ifndef PROCESSGRID_h
#define PROCESSGRID_h

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <mpi.h>
#pragma GCC diagnostic pop

#include "Wrapper.h"

Expand Down
8 changes: 4 additions & 4 deletions Source/CPlusPlus/SMatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ Matrix_lsc::Matrix_lsc(int columns, int rows) {

////////////////////////////////////////////////////////////////////////////////
Matrix_lsr::Matrix_lsr(std::string file_name) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
ConstructMatrixFromFile_lsr_wrp(ih_this, &file_name.c_str()[0],
&string_length);
}
Matrix_lsc::Matrix_lsc(std::string file_name) {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
ConstructMatrixFromFile_lsc_wrp(ih_this, &file_name.c_str()[0],
&string_length);
}
Expand Down Expand Up @@ -193,12 +193,12 @@ void Matrix_lsc::Print() const { PrintMatrix_lsc_wrp(ih_this); }

////////////////////////////////////////////////////////////////////////////////
void Matrix_lsr::WriteToMatrixMarket(string file_name) const {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
PrintMatrixF_lsr_wrp(ih_this, &file_name.c_str()[0], &string_length);
}

void Matrix_lsc::WriteToMatrixMarket(string file_name) const {
int string_length = file_name.length();
int string_length = static_cast<int>(file_name.length());
PrintMatrixF_lsc_wrp(ih_this, &file_name.c_str()[0], &string_length);
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Fortran/CholeskySolversModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ SUBROUTINE BroadcastVector_r(num_values, indices, values, root, comm)
!> Root from which we broadcast.
INTEGER, INTENT(IN) :: root
!> Communicator to broadcast along.
INTEGER, INTENT(INOUT) :: comm
INTEGER, INTENT(IN) :: comm
!! Local
INTEGER :: err

Expand Down Expand Up @@ -153,7 +153,7 @@ SUBROUTINE DotAllHelper_r(num_values_i, indices_i, values_i, num_values_j, &
!> The dot product values for each vector j.
REAL(NTREAL), DIMENSION(:), INTENT(OUT) :: out_values
!> The communicator to reduce along.
INTEGER, INTENT(INOUT) :: comm
INTEGER, INTENT(IN) :: comm

#include "solver_includes/DotAllHelper.f90"

Expand Down
12 changes: 6 additions & 6 deletions Source/Fortran/ConvergenceMonitorModule.F90
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
!> A module for monitoring convergence of an iterative algorithim.
!! In basic mode, we monitor that the last value isn't below the tight cutoff.
!! In basic mode, we monitor that the last value is not below the tight cutoff.
!! In automatic mode we monitor the following conditions:
!! o The last value can't be negative
!! o The last value can not be negative
!! o The moving average is within an order of magnitude
!! o The value isn't above the loose cutoff
!! o The value is not above the loose cutoff
MODULE ConvergenceMonitor
USE DataTypesModule, ONLY : NTREAL
USE LoggingModule, ONLY : EnterSubLog, ExitSubLog, WriteElement, &
Expand All @@ -18,7 +18,7 @@ MODULE ConvergenceMonitor
REAL(NTREAL), DIMENSION(:), ALLOCATABLE :: win_long
!> The number of values that have been added
INTEGER :: nval
!> We aren't converged if the average isn't below this.
!> We are not converged if the average is not below this.
REAL(NTREAL) :: loose_cutoff
!> We definitely are converged if the last value is below this.
REAL(NTREAL) :: tight_cutoff
Expand All @@ -40,7 +40,7 @@ PURE SUBROUTINE ConstructMonitor(this, short_len_in, long_len_in, &
INTEGER, INTENT(IN), OPTIONAL :: short_len_in
!> The length of the long window (default: 6)
INTEGER, INTENT(IN), OPTIONAL :: long_len_in
!> If the average is greater than this than we aren't
!> If the average is greater than this than we are not
!! converged (default: 0.01)
REAL(NTREAL), INTENT(IN), OPTIONAL :: loose_cutoff_in
!> If the last value is less than this, we definitely are converged
Expand Down Expand Up @@ -149,7 +149,7 @@ FUNCTION CheckConverged(this, be_verbose) RESULT(conv)
!! Automatic disabled
conv = .TRUE.

!! First check that we've seen enough values to make a judgement.
!! First check that we have seen enough values to make a judgement.
IF (this%nval .LT. SIZE(this%win_long)) conv = .FALSE.

!! Compute Averages
Expand Down
4 changes: 2 additions & 2 deletions Source/Fortran/EigenBoundsModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ SUBROUTINE PowerBounds(this, max_value, solver_parameters_in)
CALL ScaleMatrix(vector2, scale_value)
CALL CopyMatrix(vector2, vector)

!! Aitken's Extrapolation
!! Aitken Extrapolation
ritz_values(1) = ritz_values(2)
ritz_values(2) = ritz_values(3)
ritz_values(3) = max_value
Expand All @@ -154,7 +154,7 @@ SUBROUTINE PowerBounds(this, max_value, solver_parameters_in)
aitken_values(3) = ritz_values(3)
END IF

!! Check if Converged - pass the negative value because we're looking
!! Check if Converged - pass the negative value because we are looking
!! for the largest eigenvalue value.
CALL AppendValue(params%monitor, &
& - (aitken_values(3) - aitken_values(2)))
Expand Down
2 changes: 1 addition & 1 deletion Source/Fortran/EigenExaModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ END SUBROUTINE EigenExa_c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!> Setup the eigen exa data structures.
SUBROUTINE InitializeEigenExa(A, nvals, eigenvectors, exa)
!> The matrix we're working on.
!> The matrix we are working on.
TYPE(Matrix_ps), INTENT(IN) :: A
!> Number of eigenvalues to compute.
INTEGER, INTENT(IN) :: nvals
Expand Down
2 changes: 1 addition & 1 deletion Source/Fortran/FermiOperatorModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ SUBROUTINE ComputeX(W, I, pool, threshold, Out, W2_out)
REAL(NTREAL), INTENT(IN) :: threshold
!> The result matrix.
TYPE(Matrix_ps), INTENT(INOUT) :: Out
!> If you want the wave operator's square
!> If you want square of the wave operator
TYPE(Matrix_ps), INTENT(INOUT), OPTIONAL :: W2_out
!! Local matrices.
TYPE(Matrix_ps) :: W2, Temp
Expand Down
Loading

0 comments on commit 95b3ba3

Please sign in to comment.