[UPDATE] Modified psb_gedto_test adding utils to use in all kernels test.

This commit is contained in:
Stack-1
2025-07-09 18:47:52 +02:00
252 changed files with 25014 additions and 22660 deletions
@@ -0,0 +1,57 @@
cmake_minimum_required(VERSION 3.10)
project(psblas_project Fortran)
# Check for the installation path for psblas
if(NOT DEFINED PSBLAS_INSTALL_DIR)
message(FATAL_ERROR "Please specify the path to the psblas installation directory using -DPSBLAS_INSTALL_DIR=<path>")
endif()
# Set the include and library directories based on the provided path
set(INSTALLDIR "${PSBLAS_INSTALL_DIR}")
set(INCDIR "${INSTALLDIR}/include")
set(MODDIR "${INSTALLDIR}/modules")
set(LIBDIR "${INSTALLDIR}/lib")
# Find the psblas package
find_package(psblas REQUIRED PATHS ${INSTALLDIR})
# for Fortran compiler
include_directories(${INCDIR} ${MODDIR})
# Define executable directory
set(EXEDIR "${CMAKE_CURRENT_SOURCE_DIR}/runs")
# Ensure the executable directory exists
file(MAKE_DIRECTORY ${EXEDIR})
# PSBLAS libraries
set(PSBLAS_LIBS psblas::util psblas::prec psblas::base)
include(${CMAKE_CURRENT_LIST_DIR}/geaxpby/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/gedot/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/spmm/CMakeLists.txt)
# Create executables
add_executable(psb_geaxpby_test ${geaxpby_source_files})
add_executable(psb_gedot_test ${gedot_source_files})
add_executable(psb_spmm_test ${spmm_source_files})
# Link the necessary libraries
target_link_libraries(psb_geaxpby_test ${PSBLAS_LIBS})
target_link_libraries(psb_gedot_test ${PSBLAS_LIBS})
target_link_libraries(psb_spmm_test ${PSBLAS_LIBS})
# Set output directory
set_target_properties(psb_geaxpby_test PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${EXEDIR}
)
set_target_properties(psb_gedot_test PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${EXEDIR}
)
set_target_properties(psb_spmm_test PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${EXEDIR}
)
# Inform the user of successful configuration
message(STATUS "CMake configuration complete. Build with 'make' in the build directory.")
@@ -0,0 +1,8 @@
set(PSB_geaxpby_source_files
psb_geaxpby_test.f90
geaxpby.f90
)
foreach(file IN LISTS PSB_geaxpby_source_files)
list(APPEND geaxpby_source_files ${CMAKE_CURRENT_LIST_DIR}/${file})
endforeach()
@@ -0,0 +1,8 @@
set(PSB_gedot_source_files
psb_gedot_test.f90
gedot.f90
)
foreach(file IN LISTS PSB_gedot_source_files)
list(APPEND gedot_source_files ${CMAKE_CURRENT_LIST_DIR}/${file})
endforeach()
@@ -0,0 +1,8 @@
set(PSB_spmm_source_files
psb_spmm_test.f90
spmm.f90
)
foreach(file IN LISTS PSB_spmm_source_files)
list(APPEND spmm_source_files ${CMAKE_CURRENT_LIST_DIR}/${file})
endforeach()
+56
View File
@@ -0,0 +1,56 @@
cmake_minimum_required(VERSION 3.10)
project(pargen Fortran)
# Check for the installation path for psblas
if(NOT DEFINED PSBLAS_INSTALL_DIR)
message(FATAL_ERROR "Please specify the path to the psblas installation directory using -DPSBLAS_INSTALL_DIR=<path>")
endif()
# Set the include and library directories based on the provided path
set(INSTALLDIR "${PSBLAS_INSTALL_DIR}")
set(INCDIR "${INSTALLDIR}/include")
set(MODDIR "${INSTALLDIR}/modules")
set(LIBDIR "${INSTALLDIR}/lib")
# Find the psblas package
find_package(psblas REQUIRED PATHS ${INSTALLDIR})
# Include directories for the Fortran compiler
include_directories(${INCDIR} ${MODDIR})
# Define executable directory
set(EXEDIR "${CMAKE_CURRENT_SOURCE_DIR}/runs")
# Ensure the executable directory exists
file(MAKE_DIRECTORY ${EXEDIR})
# Source file use in all the targets
set(COMMON_SOURCE getp.f90)
# Define sources for the executables
set(SOURCES_SFOBJS ${COMMON_SOURCE} psb_sf_sample.f90)
set(SOURCES_DFOBJS ${COMMON_SOURCE} psb_df_sample.f90)
set(SOURCES_CFOBJS ${COMMON_SOURCE} psb_cf_sample.f90)
set(SOURCES_ZFOBJS ${COMMON_SOURCE} psb_zf_sample.f90)
# Create executables
add_executable(psb_sf_sample ${SOURCES_SFOBJS})
target_link_libraries(psb_sf_sample psblas::util psblas::linsolve psblas::prec psblas::base)
add_executable(psb_df_sample ${SOURCES_DFOBJS})
target_link_libraries(psb_df_sample psblas::util psblas::linsolve psblas::prec psblas::base)
add_executable(psb_cf_sample ${SOURCES_CFOBJS})
target_link_libraries(psb_cf_sample psblas::util psblas::linsolve psblas::prec psblas::base)
add_executable(psb_zf_sample ${SOURCES_ZFOBJS})
target_link_libraries(psb_zf_sample psblas::util psblas::linsolve psblas::prec psblas::base)
# Set output directory for executables
foreach(target psb_sf_sample psb_df_sample psb_cf_sample psb_zf_sample)
set_target_properties(${target} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${EXEDIR}
)
endforeach()
+4 -4
View File
@@ -185,7 +185,7 @@ program psb_cf_sample
endif
call psb_barrier(ctxt)
call distr_mtpart(psb_root_,ctxt)
call distr_mtpart(ione*psb_root_,ctxt)
call getv_mtpart(ivg)
call psb_matdist(aux_a, a, ctxt,desc_a,info,fmt=afmt,vg=ivg)
@@ -194,7 +194,7 @@ program psb_cf_sample
call psb_matdist(aux_a, a, ctxt,desc_a,info,fmt=afmt,parts=part_block)
end select
call psb_scatter(b_col_glob,b_col,desc_a,info,root=psb_root_)
call psb_scatter(b_col_glob,b_col,desc_a,info,root=ione*psb_root_)
call psb_geall(x_col,desc_a,info)
call x_col%zero()
call psb_geasb(x_col,desc_a,info)
@@ -274,9 +274,9 @@ program psb_cf_sample
& desc_a%get_fmt()
end if
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
call psb_gather(x_col_glob,x_col,desc_a,info,root=ione*psb_root_)
if (info == psb_success_) &
& call psb_gather(r_col_glob,r_col,desc_a,info,root=psb_root_)
& call psb_gather(r_col_glob,r_col,desc_a,info,root=ione*psb_root_)
if (info /= psb_success_) goto 9999
if (iam == psb_root_) then
write(psb_err_unit,'(" ")')
+4 -4
View File
@@ -185,7 +185,7 @@ program psb_df_sample
endif
call psb_barrier(ctxt)
call distr_mtpart(psb_root_,ctxt)
call distr_mtpart(ione*psb_root_,ctxt)
call getv_mtpart(ivg)
call psb_matdist(aux_a, a, ctxt,desc_a,info,fmt=afmt,vg=ivg)
@@ -194,7 +194,7 @@ program psb_df_sample
call psb_matdist(aux_a, a, ctxt,desc_a,info,fmt=afmt,parts=part_block)
end select
call psb_scatter(b_col_glob,b_col,desc_a,info,root=psb_root_)
call psb_scatter(b_col_glob,b_col,desc_a,info,root=ione*psb_root_)
call psb_geall(x_col,desc_a,info)
call x_col%zero()
call psb_geasb(x_col,desc_a,info)
@@ -276,9 +276,9 @@ program psb_df_sample
& desc_a%get_fmt()
end if
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
call psb_gather(x_col_glob,x_col,desc_a,info,root=ione*psb_root_)
if (info == psb_success_) &
& call psb_gather(r_col_glob,r_col,desc_a,info,root=psb_root_)
& call psb_gather(r_col_glob,r_col,desc_a,info,root=ione*psb_root_)
if (info /= psb_success_) goto 9999
if (iam == psb_root_) then
write(psb_err_unit,'(" ")')
+4 -4
View File
@@ -185,7 +185,7 @@ program psb_sf_sample
endif
call psb_barrier(ctxt)
call distr_mtpart(psb_root_,ctxt)
call distr_mtpart(ione*psb_root_,ctxt)
call getv_mtpart(ivg)
call psb_matdist(aux_a, a, ctxt,desc_a,info,fmt=afmt,vg=ivg)
@@ -194,7 +194,7 @@ program psb_sf_sample
call psb_matdist(aux_a, a, ctxt,desc_a,info,fmt=afmt,parts=part_block)
end select
call psb_scatter(b_col_glob,b_col,desc_a,info,root=psb_root_)
call psb_scatter(b_col_glob,b_col,desc_a,info,root=ione*psb_root_)
call psb_geall(x_col,desc_a,info)
call x_col%zero()
call psb_geasb(x_col,desc_a,info)
@@ -276,9 +276,9 @@ program psb_sf_sample
& desc_a%get_fmt()
end if
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
call psb_gather(x_col_glob,x_col,desc_a,info,root=ione*psb_root_)
if (info == psb_success_) &
& call psb_gather(r_col_glob,r_col,desc_a,info,root=psb_root_)
& call psb_gather(r_col_glob,r_col,desc_a,info,root=ione*psb_root_)
if (info /= psb_success_) goto 9999
if (iam == psb_root_) then
write(psb_err_unit,'(" ")')
+4 -4
View File
@@ -185,7 +185,7 @@ program psb_zf_sample
endif
call psb_barrier(ctxt)
call distr_mtpart(psb_root_,ctxt)
call distr_mtpart(ione*psb_root_,ctxt)
call getv_mtpart(ivg)
call psb_matdist(aux_a, a, ctxt,desc_a,info,fmt=afmt,vg=ivg)
@@ -194,7 +194,7 @@ program psb_zf_sample
call psb_matdist(aux_a, a, ctxt,desc_a,info,fmt=afmt,parts=part_block)
end select
call psb_scatter(b_col_glob,b_col,desc_a,info,root=psb_root_)
call psb_scatter(b_col_glob,b_col,desc_a,info,root=ione*psb_root_)
call psb_geall(x_col,desc_a,info)
call x_col%zero()
call psb_geasb(x_col,desc_a,info)
@@ -274,9 +274,9 @@ program psb_zf_sample
& desc_a%get_fmt()
end if
call psb_gather(x_col_glob,x_col,desc_a,info,root=psb_root_)
call psb_gather(x_col_glob,x_col,desc_a,info,root=ione*psb_root_)
if (info == psb_success_) &
& call psb_gather(r_col_glob,r_col,desc_a,info,root=psb_root_)
& call psb_gather(r_col_glob,r_col,desc_a,info,root=ione*psb_root_)
if (info /= psb_success_) goto 9999
if (iam == psb_root_) then
write(psb_err_unit,'(" ")')
+12 -10
View File
@@ -2,16 +2,18 @@ cmake_minimum_required(VERSION 3.10)
project(HelloWorld Fortran)
# Accept a user-defined library path
#set(LIBRARY_DIR "" CACHE PATH "Path to the library directory")
set(PSBLAS_INSTALL_DIR "" CACHE PATH "Path to the library directory")
# Check if the user provided a library directory
#if(NOT LIBRARY_DIR)
# message(FATAL_ERROR "Library directory not specified! Use -DLIBRARY_DIR=path/to/library")
#endif()
if(NOT PSBLAS_INSTALL_DIR)
message(FATAL_ERROR "Library directory not specified! Use -DLIBRARY_DIR=path/to/library")
endif()
# Include CMakePackageConfigHelpers to work with configuration files
include(CMakePackageConfigHelpers)
# Find the package
find_package(psblas REQUIRED)
find_package(psblas REQUIRED PATHS ${PSBLAS_INSTALL_DIR}/lib/cmake/psblas NO_DEFAULT_PATH)
# Check if the package was found
if(NOT psblas_FOUND)
@@ -19,15 +21,15 @@ if(NOT psblas_FOUND)
endif()
# Include directories for the library
#include_directories(${LIBRARY_DIR}/include) # Path to header files
include_directories(${psblas_DIR}/modules) # Path to module files
message(STATUS "Library directory ${psblas_DIR}")
include_directories(${PSBLAS_INSTALL_DIR}/include) # Path to header files
include_directories(${psblas_DIR}/modules) # Path to module files
message(STATUS "Library directory: ${psblas_DIR}")
# Add the executables
add_executable(hello hello.f90)
add_executable(pingpong pingpong.f90)
# Link the specific library targets
target_link_libraries(hello PRIVATE psblas::base)
target_link_libraries(pingpong PRIVATE psblas::base)
@@ -191,7 +191,7 @@ contains
integer(psb_ipk_) :: npx,npy,npz, iamx,iamy,iamz,mynx,myny,mynz
integer(psb_ipk_), allocatable :: bndx(:),bndy(:),bndz(:)
! Process grid
integer(psb_ipk_) :: np, iam
integer(psb_ipk_) :: np, iam, nth
integer(psb_ipk_) :: icoeff
integer(psb_lpk_), allocatable :: irow(:),icol(:),myidx(:)
real(psb_dpk_), allocatable :: val(:)
@@ -550,6 +550,9 @@ program pdgenspmv
use psb_base_mod
use psb_util_mod
use psb_d_pde3d_mod
#if defined(PSB_OPENMP)
use omp_lib
#endif
implicit none
@@ -571,7 +574,7 @@ program pdgenspmv
real(psb_dpk_), allocatable :: tst(:)
! blacs parameters
type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: iam, np
integer(psb_ipk_) :: iam, np, nth
! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nr, ipart
@@ -589,6 +592,15 @@ program pdgenspmv
call psb_init(ctxt)
call psb_info(ctxt,iam,np)
#if defined(PSB_OPENMP)
!$OMP parallel shared(nth)
!$OMP master
nth = omp_get_num_threads()
!$OMP end master
!$OMP end parallel
#else
nth = 1
#endif
if (iam < 0) then
! This should not happen, but just in case
@@ -667,7 +679,9 @@ program pdgenspmv
flops = 2.d0*times*annz
tflops=flops
write(psb_out_unit,'("Matrix: ell1 ",i0)') idim
write(psb_out_unit,'("Test on : ",i20," processors")') np
write(psb_out_unit,'("Test on : ",i20," processes ")') np
write(psb_out_unit,'("Test on : ",i20," threads ")') nth
write(psb_out_unit,'("Total number of tasks : ",i20 )') nth*np
write(psb_out_unit,'("Size of matrix : ",i20," ")') nr
write(psb_out_unit,'("Number of nonzeros : ",i20," ")') annz
write(psb_out_unit,'("Memory occupation : ",i20," ")') amatsize
+1 -1
View File
@@ -728,7 +728,7 @@ program psb_d_pde3d
if(psb_errstatus_fatal()) goto 9999
name='pde3d90'
call psb_set_errverbosity(itwo)
call psb_cd_set_large_threshold(125000_psb_ipk_)
call psb_cd_set_hash_threshold(125000_psb_ipk_)
!
! Hello world
!
+6 -6
View File
@@ -328,7 +328,7 @@ contains
allocate(bndx(0:npx),bndy(0:npy))
! We can reuse idx2ijk for process indices as well.
call idx2ijk(iamx,iamy,iam,npx,npy,base=0)
call idx2ijk(iamx,iamy,iam,npx,npy,base=mzero)
! Now let's split the 2D square in rectangles
call dist1Didx(bndx,idim,npx)
mynx = bndx(iamx+1)-bndx(iamx)
@@ -368,7 +368,7 @@ contains
!
! Use adjcncy methods
!
integer(psb_mpk_), allocatable :: neighbours(:)
integer(psb_ipk_), allocatable :: neighbours(:)
integer(psb_mpk_) :: cnt
logical, parameter :: debug_adj=.true.
if (debug_adj.and.(np > 1)) then
@@ -376,19 +376,19 @@ contains
allocate(neighbours(np))
if (iamx < npx-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx+1,iamy,npx,npy,base=0)
call ijk2idx(neighbours(cnt),iamx+1,iamy,npx,npy,base=mzero)
end if
if (iamy < npy-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy+1,npx,npy,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy+1,npx,npy,base=mzero)
end if
if (iamx >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx-1,iamy,npx,npy,base=0)
call ijk2idx(neighbours(cnt),iamx-1,iamy,npx,npy,base=mzero)
end if
if (iamy >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy-1,npx,npy,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy-1,npx,npy,base=mzero)
end if
call psb_realloc(cnt, neighbours,info)
call desc_a%set_p_adjcncy(neighbours)
+8 -8
View File
@@ -345,7 +345,7 @@ contains
allocate(bndx(0:npx),bndy(0:npy),bndz(0:npz))
! We can reuse idx2ijk for process indices as well.
call idx2ijk(iamx,iamy,iamz,iam,npx,npy,npz,base=0)
call idx2ijk(iamx,iamy,iamz,iam,npx,npy,npz,base=mzero)
! Now let's split the 3D cube in hexahedra
call dist1Didx(bndx,idim,npx)
mynx = bndx(iamx+1)-bndx(iamx)
@@ -389,7 +389,7 @@ contains
!
! Use adjcncy methods
!
integer(psb_mpk_), allocatable :: neighbours(:)
integer(psb_ipk_), allocatable :: neighbours(:)
integer(psb_mpk_) :: cnt
logical, parameter :: debug_adj=.true.
if (debug_adj.and.(np > 1)) then
@@ -397,27 +397,27 @@ contains
allocate(neighbours(np))
if (iamx < npx-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx+1,iamy,iamz,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx+1,iamy,iamz,npx,npy,npz,base=mzero)
end if
if (iamy < npy-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy+1,iamz,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy+1,iamz,npx,npy,npz,base=mzero)
end if
if (iamz < npz-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy,iamz+1,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy,iamz+1,npx,npy,npz,base=mzero)
end if
if (iamx >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx-1,iamy,iamz,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx-1,iamy,iamz,npx,npy,npz,base=mzero)
end if
if (iamy >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy-1,iamz,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy-1,iamz,npx,npy,npz,base=mzero)
end if
if (iamz >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy,iamz-1,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy,iamz-1,npx,npy,npz,base=mzero)
end if
call psb_realloc(cnt, neighbours,info)
call desc_a%set_p_adjcncy(neighbours)
+6 -6
View File
@@ -328,7 +328,7 @@ contains
allocate(bndx(0:npx),bndy(0:npy))
! We can reuse idx2ijk for process indices as well.
call idx2ijk(iamx,iamy,iam,npx,npy,base=0)
call idx2ijk(iamx,iamy,iam,npx,npy,base=mzero)
! Now let's split the 2D square in rectangles
call dist1Didx(bndx,idim,npx)
mynx = bndx(iamx+1)-bndx(iamx)
@@ -368,7 +368,7 @@ contains
!
! Use adjcncy methods
!
integer(psb_mpk_), allocatable :: neighbours(:)
integer(psb_ipk_), allocatable :: neighbours(:)
integer(psb_mpk_) :: cnt
logical, parameter :: debug_adj=.true.
if (debug_adj.and.(np > 1)) then
@@ -376,19 +376,19 @@ contains
allocate(neighbours(np))
if (iamx < npx-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx+1,iamy,npx,npy,base=0)
call ijk2idx(neighbours(cnt),iamx+1,iamy,npx,npy,base=mzero)
end if
if (iamy < npy-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy+1,npx,npy,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy+1,npx,npy,base=mzero)
end if
if (iamx >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx-1,iamy,npx,npy,base=0)
call ijk2idx(neighbours(cnt),iamx-1,iamy,npx,npy,base=mzero)
end if
if (iamy >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy-1,npx,npy,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy-1,npx,npy,base=mzero)
end if
call psb_realloc(cnt, neighbours,info)
call desc_a%set_p_adjcncy(neighbours)
+8 -8
View File
@@ -345,7 +345,7 @@ contains
allocate(bndx(0:npx),bndy(0:npy),bndz(0:npz))
! We can reuse idx2ijk for process indices as well.
call idx2ijk(iamx,iamy,iamz,iam,npx,npy,npz,base=0)
call idx2ijk(iamx,iamy,iamz,iam,npx,npy,npz,base=mzero)
! Now let's split the 3D cube in hexahedra
call dist1Didx(bndx,idim,npx)
mynx = bndx(iamx+1)-bndx(iamx)
@@ -389,7 +389,7 @@ contains
!
! Use adjcncy methods
!
integer(psb_mpk_), allocatable :: neighbours(:)
integer(psb_ipk_), allocatable :: neighbours(:)
integer(psb_mpk_) :: cnt
logical, parameter :: debug_adj=.true.
if (debug_adj.and.(np > 1)) then
@@ -397,27 +397,27 @@ contains
allocate(neighbours(np))
if (iamx < npx-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx+1,iamy,iamz,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx+1,iamy,iamz,npx,npy,npz,base=mzero)
end if
if (iamy < npy-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy+1,iamz,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy+1,iamz,npx,npy,npz,base=mzero)
end if
if (iamz < npz-1) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy,iamz+1,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy,iamz+1,npx,npy,npz,base=mzero)
end if
if (iamx >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx-1,iamy,iamz,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx-1,iamy,iamz,npx,npy,npz,base=mzero)
end if
if (iamy >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy-1,iamz,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy-1,iamz,npx,npy,npz,base=mzero)
end if
if (iamz >0) then
cnt = cnt + 1
call ijk2idx(neighbours(cnt),iamx,iamy,iamz-1,npx,npy,npz,base=0)
call ijk2idx(neighbours(cnt),iamx,iamy,iamz-1,npx,npy,npz,base=mzero)
end if
call psb_realloc(cnt, neighbours,info)
call desc_a%set_p_adjcncy(neighbours)