Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
elpa
elpa
Commits
fa68dca7
Commit
fa68dca7
authored
Jul 18, 2017
by
Andreas Marek
Browse files
Make some functions "includable"
parent
8bdbf3fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
fa68dca7
...
...
@@ -576,6 +576,8 @@ EXTRA_DIST = \
manual_cpp
\
test
/Fortran/elpa_print_headers.X90
\
test
/Fortran/assert.h
\
src/general/prow_pcol.X90
\
src/general/map_global_to_local.X90
\
src/elpa1/elpa_reduce_add_vectors.X90
\
src/elpa1/elpa_transpose_vectors.X90
\
src/elpa1/elpa1_compute_template.X90
\
...
...
src/general/elpa_utilities.F90
View file @
fa68dca7
...
...
@@ -73,64 +73,11 @@ module ELPA_utilities
!******
contains
!-------------------------------------------------------------------------------
!Processor col for global col number
pure
function
pcol
(
global_col
,
nblk
,
np_cols
)
result
(
local_col
)
implicit
none
integer
(
kind
=
c_int
),
intent
(
in
)
::
global_col
,
nblk
,
np_cols
integer
(
kind
=
c_int
)
::
local_col
local_col
=
MOD
((
global_col
-1
)/
nblk
,
np_cols
)
end
function
!-------------------------------------------------------------------------------
!Processor row for global row number
pure
function
prow
(
global_row
,
nblk
,
np_rows
)
result
(
local_row
)
implicit
none
integer
(
kind
=
c_int
),
intent
(
in
)
::
global_row
,
nblk
,
np_rows
integer
(
kind
=
c_int
)
::
local_row
local_row
=
MOD
((
global_row
-1
)/
nblk
,
np_rows
)
end
function
#include "prow_pcol.X90"
!-------------------------------------------------------------------------------
function
map_global_array_index_to_local_index
(
iGLobal
,
jGlobal
,
iLocal
,
jLocal
,
nblk
,
np_rows
,
np_cols
,
my_prow
,
my_pcol
)
&
result
(
possible
)
implicit
none
integer
(
kind
=
c_int
)
::
pi
,
pj
,
li
,
lj
,
xi
,
xj
integer
(
kind
=
c_int
),
intent
(
in
)
::
iGlobal
,
jGlobal
,
nblk
,
np_rows
,
np_cols
,
my_prow
,
my_pcol
integer
(
kind
=
c_int
),
intent
(
out
)
::
iLocal
,
jLocal
logical
::
possible
possible
=
.true.
iLocal
=
0
jLocal
=
0
pi
=
prow
(
iGlobal
,
nblk
,
np_rows
)
if
(
my_prow
.ne.
pi
)
then
possible
=
.false.
return
endif
pj
=
pcol
(
jGlobal
,
nblk
,
np_cols
)
if
(
my_pcol
.ne.
pj
)
then
possible
=
.false.
return
endif
li
=
(
iGlobal
-1
)/(
np_rows
*
nblk
)
! block number for rows
lj
=
(
jGlobal
-1
)/(
np_cols
*
nblk
)
! block number for columns
xi
=
mod
(
(
iGlobal
-1
),
nblk
)
+1
! offset in block li
xj
=
mod
(
(
jGlobal
-1
),
nblk
)
+1
! offset in block lj
iLocal
=
li
*
nblk
+
xi
jLocal
=
lj
*
nblk
+
xj
end
function
#include "map_global_to_local.X90"
integer
function
local_index
(
idx
,
my_proc
,
num_procs
,
nblk
,
iflag
)
...
...
src/general/map_global_to_local.X90
0 → 100644
View file @
fa68dca7
function map_global_array_index_to_local_index(iGLobal, jGlobal, iLocal, jLocal , nblk, np_rows, np_cols, my_prow, my_pcol) &
result(possible)
use iso_c_binding, only : c_int
implicit none
integer(kind=c_int) :: pi, pj, li, lj, xi, xj
integer(kind=c_int), intent(in) :: iGlobal, jGlobal, nblk, np_rows, np_cols, my_prow, my_pcol
integer(kind=c_int), intent(out) :: iLocal, jLocal
logical :: possible
possible = .true.
iLocal = 0
jLocal = 0
pi = prow(iGlobal, nblk, np_rows)
if (my_prow .ne. pi) then
possible = .false.
return
endif
pj = pcol(jGlobal, nblk, np_cols)
if (my_pcol .ne. pj) then
possible = .false.
return
endif
li = (iGlobal-1)/(np_rows*nblk) ! block number for rows
lj = (jGlobal-1)/(np_cols*nblk) ! block number for columns
xi = mod( (iGlobal-1),nblk)+1 ! offset in block li
xj = mod( (jGlobal-1),nblk)+1 ! offset in block lj
iLocal = li * nblk + xi
jLocal = lj * nblk + xj
end function
src/general/prow_pcol.X90
0 → 100644
View file @
fa68dca7
!Processor col for global col number
pure function pcol(global_col, nblk, np_cols) result(local_col)
use iso_c_binding, only : c_int
implicit none
integer(kind=c_int), intent(in) :: global_col, nblk, np_cols
integer(kind=c_int) :: local_col
local_col = MOD((global_col-1)/nblk,np_cols)
end function
!Processor row for global row number
pure function prow(global_row, nblk, np_rows) result(local_row)
use iso_c_binding, only : c_int
implicit none
integer(kind=c_int), intent(in) :: global_row, nblk, np_rows
integer(kind=c_int) :: local_row
local_row = MOD((global_row-1)/nblk,np_rows)
end function
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment