From d7d01936825f455d52a75888b2d81bd6e520e9c5 Mon Sep 17 00:00:00 2001 From: william-dawson Date: Wed, 14 Oct 2020 20:46:54 +0900 Subject: [PATCH] Remove unnecessary use of c types (#158) --- Source/Fortran/MatrixMemoryPoolModule.F90 | 17 ++++++------- Source/Fortran/PSMatrixAlgebraModule.F90 | 1 - Source/Fortran/PSMatrixModule.F90 | 1 - Source/Fortran/ProcessGridModule.F90 | 31 +++++++++++------------ Source/Fortran/TripletListModule.F90 | 21 ++++++++------- Source/Fortran/TripletModule.F90 | 9 +++---- Source/Wrapper/ProcessGridModule_wrp.F90 | 6 ++--- 7 files changed, 40 insertions(+), 46 deletions(-) diff --git a/Source/Fortran/MatrixMemoryPoolModule.F90 b/Source/Fortran/MatrixMemoryPoolModule.F90 index a579a411..842b19db 100644 --- a/Source/Fortran/MatrixMemoryPoolModule.F90 +++ b/Source/Fortran/MatrixMemoryPoolModule.F90 @@ -5,7 +5,6 @@ MODULE MatrixMemoryPoolModule USE DataTypesModule, ONLY: NTREAL, NTCOMPLEX USE TripletModule, ONLY : Triplet_r, Triplet_c - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_int IMPLICIT NONE PRIVATE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -86,9 +85,9 @@ SUBROUTINE ConstructMatrixMemoryPoolSub_lr(this, columns, rows, sparsity_in) !> The matrix to construct. TYPE(MatrixMemoryPool_lr), TARGET :: this !> Number of columns in the matrix. - INTEGER(kind=c_int), INTENT(IN) :: columns + INTEGER, INTENT(IN) :: columns !> Number of rows in the matrix. - INTEGER(kind=c_int), INTENT(IN) :: rows + INTEGER, INTENT(IN) :: rows !> Estimated sparsity (optional). REAL(NTREAL), INTENT(IN), OPTIONAL :: sparsity_in @@ -104,9 +103,9 @@ SUBROUTINE ConstructMatrixMemoryPoolSub_lc(this, columns, rows, sparsity_in) !> The matrix to construct. TYPE(MatrixMemoryPool_lc), TARGET :: this !> Number of columns in the matrix. - INTEGER(kind=c_int), INTENT(IN) :: columns + INTEGER, INTENT(IN) :: columns !> Number of rows in the matrix. - INTEGER(kind=c_int), INTENT(IN) :: rows + INTEGER, INTENT(IN) :: rows !> Estimated sparsity (optional). REAL(NTREAL), INTENT(IN), OPTIONAL :: sparsity_in @@ -122,9 +121,9 @@ FUNCTION ConstructMatrixMemoryPool_lr(columns, rows, sparsity_in) RESULT(this) !> The matrix to construct. TYPE(MatrixMemoryPool_lr), TARGET :: this !> Number of columns in the matrix. - INTEGER(kind=c_int), INTENT(IN) :: columns + INTEGER, INTENT(IN) :: columns !> Number of rows in the matrix. - INTEGER(kind=c_int), INTENT(IN) :: rows + INTEGER, INTENT(IN) :: rows !> Estimated sparsity (optional). REAL(NTREAL), INTENT(IN), OPTIONAL :: sparsity_in @@ -137,9 +136,9 @@ FUNCTION ConstructMatrixMemoryPool_lc(columns, rows, sparsity_in) RESULT(this) !> The matrix to construct. TYPE(MatrixMemoryPool_lc), TARGET :: this !> Number of columns in the matrix. - INTEGER(kind=c_int), INTENT(IN) :: columns + INTEGER, INTENT(IN) :: columns !> Number of rows in the matrix. - INTEGER(kind=c_int), INTENT(IN) :: rows + INTEGER, INTENT(IN) :: rows !> Estimated sparsity (optional). REAL(NTREAL), INTENT(IN), OPTIONAL :: sparsity_in diff --git a/Source/Fortran/PSMatrixAlgebraModule.F90 b/Source/Fortran/PSMatrixAlgebraModule.F90 index 0efab346..e52ddf4f 100644 --- a/Source/Fortran/PSMatrixAlgebraModule.F90 +++ b/Source/Fortran/PSMatrixAlgebraModule.F90 @@ -21,7 +21,6 @@ MODULE PSMatrixAlgebraModule USE TimerModule, ONLY : StartTimer, StopTimer USE TripletListModule, ONLY : TripletList_r, TripletList_c USE NTMPIModule - USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE PRIVATE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/Source/Fortran/PSMatrixModule.F90 b/Source/Fortran/PSMatrixModule.F90 index 3eb21eec..d1b0194c 100644 --- a/Source/Fortran/PSMatrixModule.F90 +++ b/Source/Fortran/PSMatrixModule.F90 @@ -27,7 +27,6 @@ MODULE PSMatrixModule & SymmetrizeTripletList, GetTripletAt, RedistributeTripletLists, & & ShiftTripletList USE NTMPIModule - USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE PRIVATE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/Source/Fortran/ProcessGridModule.F90 b/Source/Fortran/ProcessGridModule.F90 index 37dfdeef..915229da 100644 --- a/Source/Fortran/ProcessGridModule.F90 +++ b/Source/Fortran/ProcessGridModule.F90 @@ -5,7 +5,6 @@ MODULE ProcessGridModule USE LoggingModule, ONLY : ActivateLogger, EnterSubLog, ExitSubLog, & & WriteHeader, WriteListElement USE NTMPIModule - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_int, c_bool #ifdef _OPENMP USE omp_lib, ONLY : omp_get_num_threads #endif @@ -81,15 +80,15 @@ MODULE ProcessGridModule SUBROUTINE ConstructProcessGrid_full(world_comm_, process_rows_, & & process_columns_, process_slices_, be_verbose_in) !> A communicator that every process in the grid is a part of. - INTEGER(kind=c_int), INTENT(IN) :: world_comm_ + INTEGER, INTENT(IN) :: world_comm_ !> The number of grid rows. - INTEGER(kind=c_int), INTENT(IN) :: process_rows_ + INTEGER, INTENT(IN) :: process_rows_ !> The number of grid columns. - INTEGER(kind=c_int), INTENT(IN) :: process_columns_ + INTEGER, INTENT(IN) :: process_columns_ !> The number of grid slices. - INTEGER(kind=c_int), INTENT(IN) :: process_slices_ + INTEGER, INTENT(IN) :: process_slices_ !> Set true to print process grid info. - LOGICAL(kind=c_bool), INTENT(IN), OPTIONAL :: be_verbose_in + LOGICAL, INTENT(IN), OPTIONAL :: be_verbose_in !! Local Data LOGICAL :: be_verbose @@ -129,13 +128,13 @@ END SUBROUTINE ConstructProcessGrid_full SUBROUTINE ConstructProcessGrid_onlyslice(world_comm_, process_slices_in, & & be_verbose_in) !> A communicator that every process in the grid is a part of. - INTEGER(kind=c_int), INTENT(IN) :: world_comm_ + INTEGER, INTENT(IN) :: world_comm_ !> The number of grid slices. - INTEGER(kind=c_int), INTENT(IN), OPTIONAL :: process_slices_in + INTEGER, INTENT(IN), OPTIONAL :: process_slices_in !> Set true to print process grid info. - LOGICAL(kind=c_bool), INTENT(IN), OPTIONAL :: be_verbose_in + LOGICAL, INTENT(IN), OPTIONAL :: be_verbose_in !! Local Data - LOGICAL(kind=c_bool) :: be_verbose + LOGICAL :: be_verbose INTEGER :: process_rows, process_columns, process_slices INTEGER :: total_processors INTEGER :: ierr @@ -170,13 +169,13 @@ SUBROUTINE ConstructNewProcessGrid_full(grid, world_comm_, process_rows_, & !> The grid to construct TYPE(ProcessGrid_t), INTENT(INOUT) :: grid !> A communicator that every process in the grid is a part of. - INTEGER(kind=c_int), INTENT(IN) :: world_comm_ + INTEGER, INTENT(IN) :: world_comm_ !> The number of grid rows. - INTEGER(kind=c_int), INTENT(IN) :: process_rows_ + INTEGER, INTENT(IN) :: process_rows_ !> The number of grid columns. - INTEGER(kind=c_int), INTENT(IN) :: process_columns_ + INTEGER, INTENT(IN) :: process_columns_ !> The number of grid slices. - INTEGER(kind=c_int), INTENT(IN) :: process_slices_ + INTEGER, INTENT(IN) :: process_slices_ !! Local Data INTEGER :: column_block_multiplier INTEGER :: row_block_multiplier @@ -303,9 +302,9 @@ SUBROUTINE ConstructNewProcessGrid_onlyslice(grid, world_comm_, & !> The grid to construct TYPE(ProcessGrid_t), INTENT(INOUT) :: grid !> A communicator that every process in the grid is a part of. - INTEGER(kind=c_int), INTENT(IN) :: world_comm_ + INTEGER, INTENT(IN) :: world_comm_ !> The number of grid slices. - INTEGER(kind=c_int), INTENT(IN), OPTIONAL :: process_slices_in + INTEGER, INTENT(IN), OPTIONAL :: process_slices_in !! Local Data INTEGER :: process_rows, process_columns, process_slices INTEGER :: total_processors diff --git a/Source/Fortran/TripletListModule.F90 b/Source/Fortran/TripletListModule.F90 index f3e16e53..8241f241 100644 --- a/Source/Fortran/TripletListModule.F90 +++ b/Source/Fortran/TripletListModule.F90 @@ -7,7 +7,6 @@ MODULE TripletListModule & ConvertTripletType USE MatrixMarketModule, ONLY : MM_SYMMETRIC, MM_SKEW_SYMMETRIC, MM_HERMITIAN USE NTMPIModule - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_int IMPLICIT NONE PRIVATE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -106,7 +105,7 @@ PURE SUBROUTINE ConstructTripletListSup_r(this, size_in) !> The triplet list to construct. TYPE(TripletList_r), INTENT(INOUT) :: this !> The length of the triplet list (default=0). - INTEGER(kind=c_int), INTENT(IN), OPTIONAL :: size_in + INTEGER, INTENT(IN), OPTIONAL :: size_in IF (PRESENT(size_in)) THEN this = ConstructTripletList_r(size_in) @@ -120,7 +119,7 @@ PURE SUBROUTINE ConstructTripletListSup_c(this, size_in) !> The triplet list to construct. TYPE(TripletList_c), INTENT(INOUT) :: this !> The length of the triplet list (default=0). - INTEGER(kind=c_int), INTENT(IN), OPTIONAL :: size_in + INTEGER, INTENT(IN), OPTIONAL :: size_in IF (PRESENT(size_in)) THEN this = ConstructTripletList_c(size_in) @@ -134,7 +133,7 @@ PURE FUNCTION ConstructTripletList_r(size_in) RESULT(this) !> The triplet list to construct. TYPE(TripletList_r) :: this !> The length of the triplet list (default=0). - INTEGER(kind=c_int), INTENT(IN), OPTIONAL :: size_in + INTEGER, INTENT(IN), OPTIONAL :: size_in INCLUDE "triplet_includes/ConstructTripletList.f90" @@ -145,7 +144,7 @@ PURE FUNCTION ConstructTripletList_c(size_in) RESULT(this) !> The triplet list to construct. TYPE(TripletList_c) :: this !> The length of the triplet list (default=0). - INTEGER(kind=c_int), INTENT(IN), OPTIONAL :: size_in + INTEGER, INTENT(IN), OPTIONAL :: size_in INCLUDE "triplet_includes/ConstructTripletList.f90" @@ -174,7 +173,7 @@ PURE SUBROUTINE ResizeTripletList_r(this, size) !> The triplet list to resize. TYPE(TripletList_r), INTENT(INOUT) :: this !> Size to resize to. - INTEGER(KIND=c_int), INTENT(IN) :: size + INTEGER, INTENT(IN) :: size !! Local Data TYPE(Triplet_r), DIMENSION(:), ALLOCATABLE :: temporary_data @@ -187,7 +186,7 @@ PURE SUBROUTINE ResizeTripletList_c(this, size) !> The triplet list to resize. TYPE(TripletList_c), INTENT(INOUT) :: this !> Size to resize to. - INTEGER(KIND=c_int), INTENT(IN) :: size + INTEGER, INTENT(IN) :: size !! Local Data TYPE(Triplet_c), DIMENSION(:), ALLOCATABLE :: temporary_data @@ -222,7 +221,7 @@ PURE SUBROUTINE SetTripletAt_r(this,index,triplet_value) !> The triplet list to set. TYPE(TripletList_r), INTENT(INOUT) :: this !> The index at which to set the triplet. - INTEGER(KIND=c_int), INTENT(IN) :: index + INTEGER, INTENT(IN) :: index !> The value of the triplet to set. TYPE(Triplet_r), INTENT(IN) :: triplet_value @@ -234,7 +233,7 @@ PURE SUBROUTINE SetTripletAt_c(this,index,triplet_value) !> The triplet list to set. TYPE(TripletList_c), INTENT(INOUT) :: this !> The index at which to set the triplet. - INTEGER(KIND=c_int), INTENT(IN) :: index + INTEGER, INTENT(IN) :: index !> The value of the triplet to set. TYPE(Triplet_c), INTENT(IN) :: triplet_value @@ -246,7 +245,7 @@ PURE SUBROUTINE GetTripletAt_r(this,index,triplet_value) !> The triplet list to get the value from. TYPE(TripletList_r), INTENT(IN) :: this !> The index from which to get the triplet. - INTEGER(kind=c_int), INTENT(IN) :: index + INTEGER, INTENT(IN) :: index !> The extracted triplet value. TYPE(Triplet_r), INTENT(OUT) :: triplet_value @@ -258,7 +257,7 @@ PURE SUBROUTINE GetTripletAt_c(this,index,triplet_value) !> The triplet list to get the value from. TYPE(TripletList_c), INTENT(IN) :: this !> The index from which to get the triplet. - INTEGER(kind=c_int), INTENT(IN) :: index + INTEGER, INTENT(IN) :: index !> The extracted triplet value. TYPE(Triplet_c), INTENT(OUT) :: triplet_value diff --git a/Source/Fortran/TripletModule.F90 b/Source/Fortran/TripletModule.F90 index 415690d4..06c709d6 100644 --- a/Source/Fortran/TripletModule.F90 +++ b/Source/Fortran/TripletModule.F90 @@ -4,7 +4,6 @@ MODULE TripletModule USE DataTypesModule, ONLY: NTREAL, MPINTREAL, NTCOMPLEX, MPINTCOMPLEX, & & MPINTINTEGER USE NTMPIModule - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_int IMPLICIT NONE PRIVATE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -12,8 +11,8 @@ MODULE TripletModule !> As this is related to matrix multiplication, the referencing indices are !> rows and columns. TYPE, PUBLIC :: Triplet_r - INTEGER(kind=c_int) :: index_column !< column value. - INTEGER(kind=c_int) :: index_row !< row value. + INTEGER :: index_column !< column value. + INTEGER :: index_row !< row value. REAL(NTREAL) :: point_value !< actual value at those indices. END TYPE Triplet_r !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -21,8 +20,8 @@ MODULE TripletModule !> As this is related to matrix multiplication, the referencing indices are !> rows and columns. TYPE, PUBLIC :: Triplet_c - INTEGER(kind=c_int) :: index_column !< column value. - INTEGER(kind=c_int) :: index_row !< row value. + INTEGER :: index_column !< column value. + INTEGER :: index_row !< row value. COMPLEX(NTCOMPLEX) :: point_value !< actual value at those indices. END TYPE Triplet_c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/Source/Wrapper/ProcessGridModule_wrp.F90 b/Source/Wrapper/ProcessGridModule_wrp.F90 index 516c1ba8..c25dee74 100644 --- a/Source/Wrapper/ProcessGridModule_wrp.F90 +++ b/Source/Wrapper/ProcessGridModule_wrp.F90 @@ -47,7 +47,7 @@ SUBROUTINE ConstructGlobalProcessGrid_wrp(world_comm_, process_rows_, & INTEGER(kind=c_int), INTENT(IN) :: process_slices_ LOGICAL(kind=c_bool), INTENT(IN) :: be_verbose CALL ConstructProcessGrid(world_comm_, process_rows_, process_columns_, & - & process_slices_, be_verbose) + & process_slices_, LOGICAL(be_verbose)) END SUBROUTINE ConstructGlobalProcessGrid_wrp !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !> Wrap the process grid construction routine. @@ -58,7 +58,7 @@ SUBROUTINE ConstructGlobalProcessGrid_onlyslice_wrp(world_comm_, & INTEGER(kind=c_int), INTENT(IN) :: process_slices_ LOGICAL(kind=c_bool), INTENT(IN) :: be_verbose CALL ConstructProcessGrid(world_comm_, process_slices_in=process_slices_, & - & be_verbose_in=be_verbose) + & be_verbose_in=LOGICAL(be_verbose)) END SUBROUTINE ConstructGlobalProcessGrid_onlyslice_wrp !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !> Wrap the process grid construction routine. @@ -66,7 +66,7 @@ SUBROUTINE ConstructGlobalProcessGrid_default_wrp(world_comm_, be_verbose) & & BIND(c,name="ConstructGlobalProcessGrid_default_wrp") INTEGER(kind=c_int), INTENT(IN) :: world_comm_ LOGICAL(kind=c_bool), INTENT(IN) :: be_verbose - CALL ConstructProcessGrid(world_comm_, be_verbose_in=be_verbose) + CALL ConstructProcessGrid(world_comm_, be_verbose_in=LOGICAL(be_verbose)) END SUBROUTINE ConstructGlobalProcessGrid_default_wrp !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !> Get the slice of the current process.