forked from danieljprice/phantom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allocate memory for omp cache, instead of using threadprivate variable
fixes danieljprice#260
- Loading branch information
Showing
5 changed files
with
84 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
!--------------------------------------------------------------------------! | ||
! The Phantom Smoothed Particle Hydrodynamics code, by Daniel Price et al. ! | ||
! Copyright (c) 2007-2022 The Authors (see AUTHORS) ! | ||
! See LICENCE file for usage and distribution conditions ! | ||
! http://phantomsph.bitbucket.io/ ! | ||
!--------------------------------------------------------------------------! | ||
module omp_cache | ||
|
||
implicit none | ||
|
||
integer, parameter :: maxcellcache = 50000 | ||
|
||
real, allocatable :: ompcache(:,:,:) | ||
|
||
public :: allocate_cache | ||
public :: deallocate_cache | ||
public :: ompcache | ||
public :: maxcellcache | ||
|
||
private | ||
|
||
contains | ||
|
||
subroutine allocate_cache | ||
use allocutils, only:allocate_array | ||
integer :: OMP_GET_MAX_THREADS, nthread | ||
|
||
nthread = OMP_GET_MAX_THREADS() | ||
call allocate_array('ompcache', ompcache, maxcellcache, 4, nthread) | ||
|
||
end subroutine allocate_cache | ||
|
||
subroutine deallocate_cache | ||
|
||
if (allocated(ompcache)) deallocate(ompcache) | ||
|
||
end subroutine deallocate_cache | ||
|
||
end module omp_cache |