Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# This uses the compilers and flags defined in the PETSc configuration
# ~~~~~~~~~~~~~~~~~

# Check PETSc version is at least 3.24.1
PETSC_VERSION_MIN := $(shell ${PETSC_DIR}/lib/petsc/bin/petscversion ge 3.24.1)
# Check PETSc version is at least 3.25.0
PETSC_VERSION_MIN := $(shell ${PETSC_DIR}/lib/petsc/bin/petscversion ge 3.25.0)
ifeq ($(PETSC_VERSION_MIN),0)
$(error PETSc version is too old. PFLARE requires at least version 3.24.1)
$(error PETSc version is too old. PFLARE requires at least version 3.25.0)
endif

# Get the flags we have on input
Expand Down
33 changes: 0 additions & 33 deletions include/finclude/PETSc_ISO_Types.h

This file was deleted.

13 changes: 6 additions & 7 deletions src/C_Fortran_Bindings.F90
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ subroutine calculate_and_build_approximate_inverse_c(input_mat_ptr, inverse_type
! computation is skipped (see calculate_and_build_approximate_inverse).
! coeffs_ptr/row_size/col_size are unchanged on return.

#include "finclude/PETSc_ISO_Types.h"

! Interface to C stdlib malloc
interface
Expand All @@ -128,15 +127,15 @@ end function c_malloc
integer(c_int), value, intent(in) :: inverse_type, poly_order, poly_sparsity_order
integer(c_int), value, intent(in) :: matrix_free_int, diag_scale_polys_int, subcomm_int
type(c_ptr), intent(inout) :: coeffs_ptr
integer(PFLARE_PETSCINT_C_KIND), intent(inout) :: row_size, col_size
PetscInt, intent(inout) :: row_size, col_size
integer(c_long_long), intent(inout) :: inv_matrix_ptr

type(tMat) :: input_mat, inv_matrix
logical :: matrix_free, subcomm, diag_scale_polys
PetscReal, dimension(:, :), contiguous, pointer :: coefficients
type(c_ptr) :: c_buf
real(PFLARE_PETSCREAL_C_KIND), pointer :: c_view(:,:)
integer(PFLARE_PETSCINT_C_KIND) :: nr, nc
PetscReal, pointer :: c_view(:,:)
PetscInt :: nr, nc
! ~~~~~~~~

input_mat%v = input_mat_ptr
Expand Down Expand Up @@ -178,9 +177,9 @@ end function c_malloc
! Fresh path: Fortran allocate may use a compiler-specific allocator
! (e.g. _mm_malloc on Intel) that is incompatible with C free().
! Copy the data into a C-malloc'd buffer so the C side can safely free() it.
nr = int(size(coefficients, 1), PFLARE_PETSCINT_C_KIND)
nc = int(size(coefficients, 2), PFLARE_PETSCINT_C_KIND)
c_buf = c_malloc(int(nr, c_size_t) * int(nc, c_size_t) * int(PFLARE_PETSCREAL_C_KIND, c_size_t))
nr = int(size(coefficients, 1), PETSC_INT_KIND)
nc = int(size(coefficients, 2), PETSC_INT_KIND)
c_buf = c_malloc(int(nr, c_size_t) * int(nc, c_size_t) * int(PETSC_REAL_KIND, c_size_t))
call c_f_pointer(c_buf, c_view, [int(nr), int(nc)])
c_view = coefficients
! For non-matrix-free: the matshell does not exist, so the Fortran allocation
Expand Down
47 changes: 23 additions & 24 deletions src/C_PETSc_Interfaces.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module c_petsc_interfaces
use petscsys

#include "petsc/finclude/petscsys.h"
#include "finclude/PETSc_ISO_Types.h"

implicit none

Expand Down Expand Up @@ -161,8 +160,8 @@ subroutine allreducesum_petscint_mine(A_array, first_int, return_int) &
bind(c, name="allreducesum_petscint_mine")
use iso_c_binding
integer(c_long_long) :: A_array
integer(PFLARE_PETSCINT_C_KIND), value :: first_int
integer(PFLARE_PETSCINT_C_KIND) :: return_int
PetscInt, value :: first_int
PetscInt :: return_int

end subroutine allreducesum_petscint_mine

Expand All @@ -173,9 +172,9 @@ end subroutine allreducesum_petscint_mine
subroutine GenerateIS_ProcAgglomeration_c(proc_stride, global_size, local_size_reduced, start) &
bind(c, name="GenerateIS_ProcAgglomeration_c")
use iso_c_binding
integer(PFLARE_PETSCINT_C_KIND), value :: proc_stride
integer(PFLARE_PETSCINT_C_KIND), value :: global_size
integer(PFLARE_PETSCINT_C_KIND) :: local_size_reduced, start
PetscInt, value :: proc_stride
PetscInt, value :: global_size
PetscInt :: local_size_reduced, start

end subroutine GenerateIS_ProcAgglomeration_c

Expand All @@ -187,8 +186,8 @@ subroutine MatPartitioning_c(A_array, n_parts, proc_stride, index) &
bind(c, name="MatPartitioning_c")
use iso_c_binding
integer(c_long_long) :: A_array
integer(PFLARE_PETSCINT_C_KIND), value :: n_parts
integer(PFLARE_PETSCINT_C_KIND) :: proc_stride
PetscInt, value :: n_parts
PetscInt :: proc_stride
integer(c_long_long) :: index
end subroutine MatPartitioning_c

Expand All @@ -212,7 +211,7 @@ subroutine MatGetNNZs_local_c(A_array, nnzs) &
bind(c, name="MatGetNNZs_local_c")
use iso_c_binding
integer(c_long_long) :: A_array
integer(PFLARE_PETSCINT_C_KIND) :: nnzs
PetscInt :: nnzs
end subroutine MatGetNNZs_local_c

end interface
Expand All @@ -223,7 +222,7 @@ subroutine MatGetNNZs_both_c(A_array, nnzs_local, nnzs_nonlocal) &
bind(c, name="MatGetNNZs_both_c")
use iso_c_binding
integer(c_long_long) :: A_array
integer(PFLARE_PETSCINT_C_KIND) :: nnzs_local, nnzs_nonlocal
PetscInt :: nnzs_local, nnzs_nonlocal
end subroutine MatGetNNZs_both_c

end interface
Expand All @@ -245,7 +244,7 @@ subroutine PCGetSetupCalled_c(A_array, setupcalled) &
bind(c, name="PCGetSetupCalled_c")
use iso_c_binding
integer(c_long_long) :: A_array
integer(PFLARE_PETSCINT_C_KIND) :: setupcalled
PetscInt :: setupcalled
end subroutine PCGetSetupCalled_c

end interface
Expand Down Expand Up @@ -291,7 +290,7 @@ subroutine remove_small_from_sparse_kokkos(A_array, tol, B_array, &
bind(c, name="remove_small_from_sparse_kokkos")
use iso_c_binding
integer(c_long_long) :: A_array
real(PFLARE_PETSCREAL_C_KIND), value :: tol
PetscReal, value :: tol
integer(c_long_long) :: B_array
integer(c_int), value :: relative_max_row_tolerance_int
integer(c_int), value :: lump_int
Expand All @@ -308,7 +307,7 @@ subroutine remove_from_sparse_match_kokkos(A_array, B_array, lump_int, alpha_int
integer(c_long_long) :: A_array
integer(c_long_long) :: B_array
integer(c_int), value :: lump_int, alpha_int
real(PFLARE_PETSCREAL_C_KIND), value :: alpha
PetscReal, value :: alpha
end subroutine remove_from_sparse_match_kokkos

end interface
Expand All @@ -319,7 +318,7 @@ subroutine MatSetAllValues_kokkos(A_array, val) &
bind(c, name="MatSetAllValues_kokkos")
use iso_c_binding
integer(c_long_long) :: A_array
real(PFLARE_PETSCREAL_C_KIND), value :: val
PetscReal, value :: val
end subroutine MatSetAllValues_kokkos

end interface
Expand All @@ -330,7 +329,7 @@ subroutine MatSetAllValues_cpu(A_array, val) &
bind(c, name="MatSetAllValues_cpu")
use iso_c_binding
integer(c_long_long) :: A_array
real(PFLARE_PETSCREAL_C_KIND), value :: val
PetscReal, value :: val
end subroutine MatSetAllValues_cpu

end interface
Expand Down Expand Up @@ -363,7 +362,7 @@ subroutine set_VecISCopyLocal_kokkos_our_level(handle, our_level, global_row_sta
use iso_c_binding
type(c_ptr), value :: handle
integer(c_int), value :: our_level
integer(PFLARE_PETSCINT_C_KIND), value :: global_row_start
PetscInt, value :: global_row_start
integer(c_long_long) :: index_fine
integer(c_long_long) :: index_coarse
end subroutine set_VecISCopyLocal_kokkos_our_level
Expand Down Expand Up @@ -413,8 +412,8 @@ subroutine MatDiagDomRatio_kokkos(A_array, max_dd_ratio_achieved, local_rows_aff
bind(c, name="MatDiagDomRatio_kokkos")
use iso_c_binding
integer(c_long_long) :: A_array
real(PFLARE_PETSCREAL_C_KIND) :: max_dd_ratio_achieved
integer(PFLARE_PETSCINT_C_KIND) :: local_rows_aff
PetscReal :: max_dd_ratio_achieved
PetscInt :: local_rows_aff
end subroutine MatDiagDomRatio_kokkos

end interface
Expand All @@ -426,9 +425,9 @@ subroutine ddc_kokkos(A_array, fraction_swap, max_dd_ratio, max_dd_ratio_achieve
bind(c, name="ddc_kokkos")
use iso_c_binding
integer(c_long_long) :: A_array
real(PFLARE_PETSCREAL_C_KIND), value :: fraction_swap
real(PFLARE_PETSCREAL_C_KIND), value :: max_dd_ratio
real(PFLARE_PETSCREAL_C_KIND), value :: max_dd_ratio_achieved
PetscReal, value :: fraction_swap
PetscReal, value :: max_dd_ratio
PetscReal, value :: max_dd_ratio_achieved
integer(c_long_long) :: Aff_array
type(c_ptr), value :: random_numbers_ptr
end subroutine ddc_kokkos
Expand Down Expand Up @@ -481,7 +480,7 @@ subroutine compute_P_from_W_kokkos(A_array, global_row_start, indices_fine, &
use iso_c_binding
integer(c_long_long) :: A_array, indices_fine, indices_coarse
integer(c_long_long) :: B_array
integer(PFLARE_PETSCINT_C_KIND), value :: global_row_start
PetscInt, value :: global_row_start
integer(c_int), value :: identity_int, reuse_int
end subroutine compute_P_from_W_kokkos

Expand All @@ -505,7 +504,7 @@ subroutine compute_R_from_Z_kokkos(A_array, global_row_start, indices_fine, &
use iso_c_binding
integer(c_long_long) :: A_array, indices_fine, indices_coarse, indices_orig
integer(c_long_long) :: B_array
integer(PFLARE_PETSCINT_C_KIND), value :: global_row_start
PetscInt, value :: global_row_start
integer(c_int), value :: identity_int, reuse_int, reuse_indices_int
end subroutine compute_R_from_Z_kokkos

Expand Down Expand Up @@ -589,7 +588,7 @@ subroutine MatAXPY_kokkos(A_array, alpha, B_array) &
use iso_c_binding
integer(c_long_long) :: A_array
integer(c_long_long) :: B_array
PFLARE_PETSCSCALAR_C_TYPE, value :: alpha
PetscScalar, value :: alpha
end subroutine MatAXPY_kokkos

end interface
Expand Down
1 change: 0 additions & 1 deletion src/DDC_Module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module ddc_module
use matdiagdom, only: MatDiagDomRatio

#include "petsc/finclude/petscmat.h"
#include "finclude/PETSc_ISO_Types.h"

implicit none

Expand Down
1 change: 0 additions & 1 deletion src/MatDiagDom.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module matdiagdom
use pflare_parameters, only: C_POINT, F_POINT

#include "petsc/finclude/petscmat.h"
#include "finclude/PETSc_ISO_Types.h"

implicit none

Expand Down
Loading
Loading