Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
science
wannier90
a75344b646227c9d7f12d90af4a35a902e940dca.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File a75344b646227c9d7f12d90af4a35a902e940dca.patch of Package wannier90
From 8ede1ab6e585c475eaa63b1e64211f43bc4fdff8 Mon Sep 17 00:00:00 2001 From: Junfeng Qiao <qiaojunfeng@outlook.com> Date: Thu, 21 Jan 2021 19:26:33 +0100 Subject: [PATCH 1/2] Allocate arrays on non-root nodes to avoid SIGSEG Although these arrays are not used by the non-root nodes, in some versions of OpenMPI (e.g. 4.0), SIGSEGV may occur when doing MPI_scatterv. Allocating 0-sized arrays could bypass the issue. --- src/disentangle.F90 | 2 ++ src/overlap.F90 | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/disentangle.F90 b/src/disentangle.F90 index d2fbd3e25..ff3b95165 100644 --- a/src/disentangle.F90 +++ b/src/disentangle.F90 @@ -204,6 +204,8 @@ subroutine dis_main() if (on_root) then allocate (m_matrix(num_wann, num_wann, nntot, num_kpts), stat=ierr) if (ierr /= 0) call io_error('Error in allocating m_matrix in dis_main') + else + allocate (m_matrix(0, 0, 0, 0), stat=ierr) endif allocate (m_matrix_local(num_wann, num_wann, nntot, counts(my_node_id)), stat=ierr) if (ierr /= 0) call io_error('Error in allocating m_matrix_local in dis_main') diff --git a/src/overlap.F90 b/src/overlap.F90 index 457405c70..c3fd6dae8 100644 --- a/src/overlap.F90 +++ b/src/overlap.F90 @@ -64,6 +64,8 @@ subroutine overlap_allocate() if (on_root) then allocate (m_matrix_orig(num_bands, num_bands, nntot, num_kpts), stat=ierr) if (ierr /= 0) call io_error('Error in allocating m_matrix_orig in overlap_read') + else + allocate (m_matrix_orig(0, 0, 0, 0)) endif allocate (m_matrix_orig_local(num_bands, num_bands, nntot, counts(my_node_id)), stat=ierr) if (ierr /= 0) call io_error('Error in allocating m_matrix_orig_local in overlap_read') @@ -76,6 +78,8 @@ subroutine overlap_allocate() allocate (m_matrix(num_wann, num_wann, nntot, num_kpts), stat=ierr) if (ierr /= 0) call io_error('Error in allocating m_matrix in overlap_read') m_matrix = cmplx_0 + else + allocate (m_matrix(0, 0, 0, 0)) endif allocate (m_matrix_local(num_wann, num_wann, nntot, counts(my_node_id)), stat=ierr) if (ierr /= 0) call io_error('Error in allocating m_matrix_local in overlap_read') @@ -563,12 +567,12 @@ subroutine overlap_dealloc() deallocate (a_matrix, stat=ierr) if (ierr /= 0) call io_error('Error deallocating a_matrix in overlap_dealloc') end if - if (on_root) then +! if (on_root) then if (allocated(m_matrix_orig)) then deallocate (m_matrix_orig, stat=ierr) if (ierr /= 0) call io_error('Error deallocating m_matrix_orig in overlap_dealloc') endif - endif +! endif if (allocated(m_matrix_orig_local)) then deallocate (m_matrix_orig_local, stat=ierr) if (ierr /= 0) call io_error('Error deallocating m_matrix_orig_local in overlap_dealloc') @@ -588,12 +592,12 @@ subroutine overlap_dealloc() ! if (ierr/=0) call io_error('Error deallocating m_matrix_local in overlap_dealloc') ! deallocate ( u_matrix, stat=ierr ) ! if (ierr/=0) call io_error('Error deallocating u_matrix in overlap_dealloc') - if (on_root) then +! if (on_root) then if (allocated(m_matrix)) then deallocate (m_matrix, stat=ierr) if (ierr /= 0) call io_error('Error deallocating m_matrix in overlap_dealloc') endif - endif +! endif if (allocated(m_matrix_local)) then deallocate (m_matrix_local, stat=ierr) if (ierr /= 0) call io_error('Error deallocating m_matrix_local in overlap_dealloc') From a8a10661c9dcd461706d39387c822d0effb1b964 Mon Sep 17 00:00:00 2001 From: Junfeng Qiao <qiaojunfeng@outlook.com> Date: Mon, 12 Jul 2021 22:53:56 +0200 Subject: [PATCH 2/2] Format code to pass pre-commit --- src/overlap.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlap.F90 b/src/overlap.F90 index c3fd6dae8..0b0f84cf6 100644 --- a/src/overlap.F90 +++ b/src/overlap.F90 @@ -593,10 +593,10 @@ subroutine overlap_dealloc() ! deallocate ( u_matrix, stat=ierr ) ! if (ierr/=0) call io_error('Error deallocating u_matrix in overlap_dealloc') ! if (on_root) then - if (allocated(m_matrix)) then - deallocate (m_matrix, stat=ierr) - if (ierr /= 0) call io_error('Error deallocating m_matrix in overlap_dealloc') - endif + if (allocated(m_matrix)) then + deallocate (m_matrix, stat=ierr) + if (ierr /= 0) call io_error('Error deallocating m_matrix in overlap_dealloc') + endif ! endif if (allocated(m_matrix_local)) then deallocate (m_matrix_local, stat=ierr)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor