New SPSPMM implementation

This commit is contained in:
Salvatore Filippone
2023-08-29 19:27:29 +02:00
parent d0cacda995
commit 0d8a5d3dc2
15 changed files with 3271 additions and 168 deletions
+9 -2
View File
@@ -60,7 +60,11 @@ SERIAL_MODS=serial/psb_s_serial_mod.o serial/psb_d_serial_mod.o \
auxil/psb_d_hsort_x_mod.o \
auxil/psb_c_hsort_x_mod.o \
auxil/psb_z_hsort_x_mod.o \
auxil/psb_d_rb_idx_tree_mod.o auxil/psb_rb_idx_tree_mod.o \
auxil/psb_s_rb_idx_tree_mod.o \
auxil/psb_d_rb_idx_tree_mod.o \
auxil/psb_c_rb_idx_tree_mod.o \
auxil/psb_z_rb_idx_tree_mod.o \
auxil/psb_rb_idx_tree_mod.o \
serial/psb_base_mat_mod.o serial/psb_mat_mod.o\
serial/psb_s_base_mat_mod.o serial/psb_s_csr_mat_mod.o serial/psb_s_csc_mat_mod.o serial/psb_s_mat_mod.o \
serial/psb_d_base_mat_mod.o serial/psb_d_csr_mat_mod.o serial/psb_d_csc_mat_mod.o serial/psb_d_mat_mod.o \
@@ -277,8 +281,11 @@ serial/psb_z_vect_mod.o: serial/psb_z_base_vect_mod.o serial/psb_i_vect_mod.o
serial/psb_s_serial_mod.o serial/psb_d_serial_mod.o serial/psb_c_serial_mod.o serial/psb_z_serial_mod.o: serial/psb_mat_mod.o auxil/psb_string_mod.o auxil/psb_sort_mod.o auxil/psi_serial_mod.o
serial/psb_vect_mod.o: serial/psb_i_vect_mod.o serial/psb_l_vect_mod.o serial/psb_d_vect_mod.o serial/psb_s_vect_mod.o serial/psb_c_vect_mod.o serial/psb_z_vect_mod.o
auxil/psb_s_rb_idx_tree_mod.o: serial/psb_s_csr_mat_mod.o psb_realloc_mod.o
auxil/psb_d_rb_idx_tree_mod.o: serial/psb_d_csr_mat_mod.o psb_realloc_mod.o
auxil/psb_rb_idx_tree_mod.o: auxil/psb_d_rb_idx_tree_mod.o
auxil/psb_c_rb_idx_tree_mod.o: serial/psb_c_csr_mat_mod.o psb_realloc_mod.o
auxil/psb_z_rb_idx_tree_mod.o: serial/psb_z_csr_mat_mod.o psb_realloc_mod.o
auxil/psb_rb_idx_tree_mod.o: auxil/psb_s_rb_idx_tree_mod.o auxil/psb_d_rb_idx_tree_mod.o auxil/psb_c_rb_idx_tree_mod.o auxil/psb_z_rb_idx_tree_mod.o
error.o psb_realloc_mod.o: psb_error_mod.o
psb_error_impl.o: psb_penv_mod.o
@@ -0,0 +1,128 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! package: psb_c_rb_idx_tree_mod
!
! Red black tree implementation ordered by index
!
! Each node contains and index and a double precision value
!
! The tree should always be well balanced
!
! inserting a node with an existing index will
! add up the new value to the old one
! Contributed by Dimitri Walther
!
module psb_c_rb_idx_tree_mod
use psb_const_mod
implicit none
type :: psb_c_rb_idx_node
integer(psb_ipk_) :: idx
complex(psb_spk_) :: val
type(psb_c_rb_idx_node), pointer :: left, right, parent
logical :: is_red
end type psb_c_rb_idx_node
type :: psb_c_rb_idx_tree
type(psb_c_rb_idx_node), pointer :: root
integer(psb_ipk_) :: nnz
contains
procedure :: insert => psb_c_rb_idx_tree_insert
end type psb_c_rb_idx_tree
interface psb_rb_idx_tree_insert
subroutine psb_c_rb_idx_tree_insert(this, idx, val)
import :: psb_ipk_, psb_spk_, psb_c_rb_idx_tree
implicit none
class(psb_c_rb_idx_tree), intent(inout) :: this
integer(psb_ipk_), intent(in) :: idx
complex(psb_spk_), intent(in) :: val
end subroutine psb_c_rb_idx_tree_insert
end interface psb_rb_idx_tree_insert
interface psb_rb_idx_tree_scalar_sparse_row_mul
subroutine psb_c_rb_idx_tree_scalar_sparse_row_mul(tree, scalar, mat, row_num)
use psb_c_csr_mat_mod, only : psb_c_csr_sparse_mat
import :: psb_ipk_, psb_spk_, psb_c_rb_idx_tree
implicit none
type(psb_c_rb_idx_tree), intent(inout) :: tree
complex(psb_spk_), intent(in) :: scalar
type(psb_c_csr_sparse_mat), intent(in) :: mat
integer(psb_ipk_), intent(in) :: row_num
end subroutine psb_c_rb_idx_tree_scalar_sparse_row_mul
end interface psb_rb_idx_tree_scalar_sparse_row_mul
interface psb_rb_idx_tree_merge
subroutine psb_c_rb_idx_tree_merge(trees, mat)
use psb_c_csr_mat_mod, only : psb_c_csr_sparse_mat
import :: psb_c_rb_idx_tree
type(psb_c_rb_idx_tree), allocatable, intent(inout) :: trees(:)
type(psb_c_csr_sparse_mat), intent(inout) :: mat
end subroutine psb_c_rb_idx_tree_merge
end interface psb_rb_idx_tree_merge
interface psb_rb_idx_tree_fix_insertion
subroutine psb_c_rb_idx_tree_fix_insertion(this, node)
import :: psb_c_rb_idx_tree, psb_c_rb_idx_node
implicit none
class(psb_c_rb_idx_tree), intent(inout) :: this
type(psb_c_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_c_rb_idx_tree_fix_insertion
end interface psb_rb_idx_tree_fix_insertion
interface psb_rb_idx_tree_swap_colors
subroutine psb_c_rb_idx_tree_swap_colors(n1, n2)
import :: psb_c_rb_idx_node
implicit none
type(psb_c_rb_idx_node), pointer, intent(inout) :: n1, n2
end subroutine psb_c_rb_idx_tree_swap_colors
end interface psb_rb_idx_tree_swap_colors
interface psb_rb_idx_tree_rotate_right
subroutine psb_c_rb_idx_tree_rotate_right(node)
import :: psb_c_rb_idx_node
implicit none
type(psb_c_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_c_rb_idx_tree_rotate_right
end interface psb_rb_idx_tree_rotate_right
interface psb_rb_idx_tree_rotate_left
subroutine psb_c_rb_idx_tree_rotate_left(node)
import :: psb_c_rb_idx_node
implicit none
type(psb_c_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_c_rb_idx_tree_rotate_left
end interface psb_rb_idx_tree_rotate_left
end module psb_c_rb_idx_tree_mod
+6 -3
View File
@@ -43,7 +43,10 @@
! Contributed by Dimitri Walther
!
module psb_rb_idx_tree_mod
use psb_const_mod
use psb_d_rb_idx_tree_mod
use psb_const_mod
use psb_s_rb_idx_tree_mod
use psb_d_rb_idx_tree_mod
use psb_c_rb_idx_tree_mod
use psb_z_rb_idx_tree_mod
end module psb_rb_idx_tree_mod
@@ -0,0 +1,128 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! package: psb_s_rb_idx_tree_mod
!
! Red black tree implementation ordered by index
!
! Each node contains and index and a double precision value
!
! The tree should always be well balanced
!
! inserting a node with an existing index will
! add up the new value to the old one
! Contributed by Dimitri Walther
!
module psb_s_rb_idx_tree_mod
use psb_const_mod
implicit none
type :: psb_s_rb_idx_node
integer(psb_ipk_) :: idx
real(psb_spk_) :: val
type(psb_s_rb_idx_node), pointer :: left, right, parent
logical :: is_red
end type psb_s_rb_idx_node
type :: psb_s_rb_idx_tree
type(psb_s_rb_idx_node), pointer :: root
integer(psb_ipk_) :: nnz
contains
procedure :: insert => psb_s_rb_idx_tree_insert
end type psb_s_rb_idx_tree
interface psb_rb_idx_tree_insert
subroutine psb_s_rb_idx_tree_insert(this, idx, val)
import :: psb_ipk_, psb_spk_, psb_s_rb_idx_tree
implicit none
class(psb_s_rb_idx_tree), intent(inout) :: this
integer(psb_ipk_), intent(in) :: idx
real(psb_spk_), intent(in) :: val
end subroutine psb_s_rb_idx_tree_insert
end interface psb_rb_idx_tree_insert
interface psb_rb_idx_tree_scalar_sparse_row_mul
subroutine psb_s_rb_idx_tree_scalar_sparse_row_mul(tree, scalar, mat, row_num)
use psb_s_csr_mat_mod, only : psb_s_csr_sparse_mat
import :: psb_ipk_, psb_spk_, psb_s_rb_idx_tree
implicit none
type(psb_s_rb_idx_tree), intent(inout) :: tree
real(psb_spk_), intent(in) :: scalar
type(psb_s_csr_sparse_mat), intent(in) :: mat
integer(psb_ipk_), intent(in) :: row_num
end subroutine psb_s_rb_idx_tree_scalar_sparse_row_mul
end interface psb_rb_idx_tree_scalar_sparse_row_mul
interface psb_rb_idx_tree_merge
subroutine psb_s_rb_idx_tree_merge(trees, mat)
use psb_s_csr_mat_mod, only : psb_s_csr_sparse_mat
import :: psb_s_rb_idx_tree
type(psb_s_rb_idx_tree), allocatable, intent(inout) :: trees(:)
type(psb_s_csr_sparse_mat), intent(inout) :: mat
end subroutine psb_s_rb_idx_tree_merge
end interface psb_rb_idx_tree_merge
interface psb_rb_idx_tree_fix_insertion
subroutine psb_s_rb_idx_tree_fix_insertion(this, node)
import :: psb_s_rb_idx_tree, psb_s_rb_idx_node
implicit none
class(psb_s_rb_idx_tree), intent(inout) :: this
type(psb_s_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_s_rb_idx_tree_fix_insertion
end interface psb_rb_idx_tree_fix_insertion
interface psb_rb_idx_tree_swap_colors
subroutine psb_s_rb_idx_tree_swap_colors(n1, n2)
import :: psb_s_rb_idx_node
implicit none
type(psb_s_rb_idx_node), pointer, intent(inout) :: n1, n2
end subroutine psb_s_rb_idx_tree_swap_colors
end interface psb_rb_idx_tree_swap_colors
interface psb_rb_idx_tree_rotate_right
subroutine psb_s_rb_idx_tree_rotate_right(node)
import :: psb_s_rb_idx_node
implicit none
type(psb_s_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_s_rb_idx_tree_rotate_right
end interface psb_rb_idx_tree_rotate_right
interface psb_rb_idx_tree_rotate_left
subroutine psb_s_rb_idx_tree_rotate_left(node)
import :: psb_s_rb_idx_node
implicit none
type(psb_s_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_s_rb_idx_tree_rotate_left
end interface psb_rb_idx_tree_rotate_left
end module psb_s_rb_idx_tree_mod
@@ -0,0 +1,128 @@
!
! Parallel Sparse BLAS version 3.5
! (C) Copyright 2006-2018
! Salvatore Filippone
! Alfredo Buttari
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
! 1. Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! 2. Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions, and the following disclaimer in the
! documentation and/or other materials provided with the distribution.
! 3. The name of the PSBLAS group or the names of its contributors may
! not be used to endorse or promote products derived from this
! software without specific written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! POSSIBILITY OF SUCH DAMAGE.
!
!
!
! package: psb_z_rb_idx_tree_mod
!
! Red black tree implementation ordered by index
!
! Each node contains and index and a double precision value
!
! The tree should always be well balanced
!
! inserting a node with an existing index will
! add up the new value to the old one
! Contributed by Dimitri Walther
!
module psb_z_rb_idx_tree_mod
use psb_const_mod
implicit none
type :: psb_z_rb_idx_node
integer(psb_ipk_) :: idx
complex(psb_dpk_) :: val
type(psb_z_rb_idx_node), pointer :: left, right, parent
logical :: is_red
end type psb_z_rb_idx_node
type :: psb_z_rb_idx_tree
type(psb_z_rb_idx_node), pointer :: root
integer(psb_ipk_) :: nnz
contains
procedure :: insert => psb_z_rb_idx_tree_insert
end type psb_z_rb_idx_tree
interface psb_rb_idx_tree_insert
subroutine psb_z_rb_idx_tree_insert(this, idx, val)
import :: psb_ipk_, psb_dpk_, psb_z_rb_idx_tree
implicit none
class(psb_z_rb_idx_tree), intent(inout) :: this
integer(psb_ipk_), intent(in) :: idx
complex(psb_dpk_), intent(in) :: val
end subroutine psb_z_rb_idx_tree_insert
end interface psb_rb_idx_tree_insert
interface psb_rb_idx_tree_scalar_sparse_row_mul
subroutine psb_z_rb_idx_tree_scalar_sparse_row_mul(tree, scalar, mat, row_num)
use psb_z_csr_mat_mod, only : psb_z_csr_sparse_mat
import :: psb_ipk_, psb_dpk_, psb_z_rb_idx_tree
implicit none
type(psb_z_rb_idx_tree), intent(inout) :: tree
complex(psb_dpk_), intent(in) :: scalar
type(psb_z_csr_sparse_mat), intent(in) :: mat
integer(psb_ipk_), intent(in) :: row_num
end subroutine psb_z_rb_idx_tree_scalar_sparse_row_mul
end interface psb_rb_idx_tree_scalar_sparse_row_mul
interface psb_rb_idx_tree_merge
subroutine psb_z_rb_idx_tree_merge(trees, mat)
use psb_z_csr_mat_mod, only : psb_z_csr_sparse_mat
import :: psb_z_rb_idx_tree
type(psb_z_rb_idx_tree), allocatable, intent(inout) :: trees(:)
type(psb_z_csr_sparse_mat), intent(inout) :: mat
end subroutine psb_z_rb_idx_tree_merge
end interface psb_rb_idx_tree_merge
interface psb_rb_idx_tree_fix_insertion
subroutine psb_z_rb_idx_tree_fix_insertion(this, node)
import :: psb_z_rb_idx_tree, psb_z_rb_idx_node
implicit none
class(psb_z_rb_idx_tree), intent(inout) :: this
type(psb_z_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_z_rb_idx_tree_fix_insertion
end interface psb_rb_idx_tree_fix_insertion
interface psb_rb_idx_tree_swap_colors
subroutine psb_z_rb_idx_tree_swap_colors(n1, n2)
import :: psb_z_rb_idx_node
implicit none
type(psb_z_rb_idx_node), pointer, intent(inout) :: n1, n2
end subroutine psb_z_rb_idx_tree_swap_colors
end interface psb_rb_idx_tree_swap_colors
interface psb_rb_idx_tree_rotate_right
subroutine psb_z_rb_idx_tree_rotate_right(node)
import :: psb_z_rb_idx_node
implicit none
type(psb_z_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_z_rb_idx_tree_rotate_right
end interface psb_rb_idx_tree_rotate_right
interface psb_rb_idx_tree_rotate_left
subroutine psb_z_rb_idx_tree_rotate_left(node)
import :: psb_z_rb_idx_node
implicit none
type(psb_z_rb_idx_node), pointer, intent(inout) :: node
end subroutine psb_z_rb_idx_tree_rotate_left
end interface psb_rb_idx_tree_rotate_left
end module psb_z_rb_idx_tree_mod
+3 -2
View File
@@ -45,6 +45,7 @@
module psb_d_csr_mat_mod
use psb_d_base_mat_mod
!> \namespace psb_base_mod \class psb_d_csr_sparse_mat
!! \extends psb_d_base_mat_mod::psb_d_base_sparse_mat
!!
@@ -577,8 +578,8 @@ module psb_d_csr_mat_mod
integer(psb_ipk_), intent(out) :: info
end subroutine psb_d_csr_scals
end interface
!> \namespace psb_base_mod \class psb_ld_csr_sparse_mat
!> \namespace psb_base_mod \class psb_ld_csr_sparse_mat
!! \extends psb_ld_base_mat_mod::psb_ld_base_sparse_mat
!!
!! psb_ld_csr_sparse_mat type and the related methods.
+1 -4
View File
@@ -79,10 +79,7 @@
module psb_d_mat_mod
use psb_d_base_mat_mod
use psb_d_csr_mat_mod, only : psb_d_csr_sparse_mat, psb_ld_csr_sparse_mat, &
spspmm_impl, spspmm_serial, spspmm_omp_gustavson, &
spspmm_omp_gustavson_1d, spspmm_serial_rb_tree, &
spspmm_omp_rb_tree, spspmm_omp_two_pass
use psb_d_csr_mat_mod, only : psb_d_csr_sparse_mat, psb_ld_csr_sparse_mat
use psb_d_csc_mat_mod, only : psb_d_csc_sparse_mat, psb_ld_csc_sparse_mat
type :: psb_dspmat_type