55 use,
INTRINSIC :: iso_c_binding, only: c_char, c_null_char, c_int, &
56 c_long, c_short, c_long_long, c_ptr, c_loc
64 PUBLIC ::
ut_init, ut_init_decomposition, &
66 ut_init_transposition, ut_transpose, &
73 INTEGER,
PARAMETER :: inflate_inner = 1
74 INTEGER,
PARAMETER :: inflate_outer = 2
84 INTERFACE ut_init_decomposition
85 MODULE PROCEDURE ut_init_decomposition_1d
86 END INTERFACE ut_init_decomposition
89 INTERFACE ut_init_transposition
90 MODULE PROCEDURE ut_init_transposition_simple
91 MODULE PROCEDURE ut_init_transposition_with_offsets
92 END INTERFACE ut_init_transposition
94 INTERFACE ut_transpose
95 MODULE PROCEDURE ut_transpose_int
96 END INTERFACE ut_transpose
99 SUBROUTINE xt_ut_abort(msg, source, line) bind(C, name='xt_ut_abort')
100 import:: c_char, c_int
102 CHARACTER(C_CHAR),
DIMENSION(*),
INTENT(in) :: msg
103 CHARACTER(C_CHAR),
DIMENSION(*),
INTENT(in) :: source
104 INTEGER(C_INT),
INTENT(in) :: line
109 SUBROUTINE xt_ut_init(decomp_size, comm_tmpl_size, comm_size, debug_lvl, &
110 mode, idebug_unit) bind(C, name='xt_ut_init')
113 INTEGER(C_INT),
VALUE,
INTENT(in) :: decomp_size, comm_tmpl_size, &
114 comm_size, debug_lvl, mode, idebug_unit
125 bind(c, name=
'xt_ut_init_decomposition_1d') result(r)
130 INTEGER(xt_int_kind),
DIMENSION(*),
INTENT(in) :: idx_vec
131 INTEGER(c_int),
VALUE,
INTENT(in) :: idx_vec_n
137 bind(c, name=
'xt_ut_destroy_decomposition')
140 INTEGER(C_INT),
VALUE,
INTENT(in) :: handle
146 decomp_handle_in, decomp_handle_out, mpi_world, check_unique) &
147 & bind(c, name=
'xt_ut_init_oneway_transposition_template') &
152 INTEGER(C_INT),
VALUE,
INTENT(in) :: decomp_handle_in, &
153 decomp_handle_out, mpi_world, check_unique
159 bind(c, name=
'xt_ut_destroy_transposition_template')
162 INTEGER(C_INT),
VALUE,
INTENT(in) :: handle
168 bind(c, name=
'xt_ut_init_transposition_simple') result(rc)
171 INTEGER(xt_mpi_fint_kind) :: rc
172 INTEGER(xt_mpi_fint_kind),
VALUE,
INTENT(in) :: itemplate
173 INTEGER(xt_mpi_fint_kind),
VALUE,
INTENT(in) :: datatype
179 offset_in_size, offset_out, offset_out_size, &
180 & datatype) bind(C, name='xt_ut_init_transposition')
RESULT(rc)
183 INTEGER(xt_mpi_fint_kind) :: rc
184 INTEGER(xt_mpi_fint_kind),
VALUE,
INTENT(in) :: itemplate, &
185 offset_in_size, offset_out_size
186 INTEGER(xt_mpi_fint_kind),
INTENT(in) :: offset_in(*), offset_out(*)
187 INTEGER(xt_mpi_fint_kind),
VALUE,
INTENT(in) :: datatype
193 bind(c, name=
'xt_ut_destroy_transposition')
196 INTEGER(C_INT),
VALUE,
INTENT(in) :: handle
202 direction, pt_out) bind(C, name='xt_ut_transpose')
203 import:: c_int, c_ptr
205 TYPE(c_ptr),
INTENT(in) :: pt_in, pt_out
206 INTEGER(C_INT),
VALUE,
INTENT(in) :: transposition_handle
207 INTEGER(C_INT),
VALUE,
INTENT(in) :: direction
212 LOGICAL,
PARAMETER :: debug = .true.
213 CHARACTER(len=*),
PARAMETER :: filename =
'xt_ut.f90'
217 CHARACTER(len=*),
INTENT(in) :: msg
218 CHARACTER(len=*),
INTENT(in) :: source
219 INTEGER,
INTENT(in) :: line
221 CALL xt_ut_abort(trim(msg)//c_null_char, source, line)
229 SUBROUTINE ut_init(decomp_size, comm_tmpl_size, comm_size, debug_lvl, &
231 INTEGER,
INTENT(in) :: decomp_size
232 INTEGER,
INTENT(in) :: comm_tmpl_size
233 INTEGER,
INTENT(in) :: comm_size
234 INTEGER,
INTENT(in) :: debug_lvl
235 INTEGER,
INTENT(in) :: mode
236 INTEGER,
INTENT(in) :: debug_unit
238 CALL xt_ut_init(decomp_size, comm_tmpl_size, comm_size, debug_lvl, &
243 SUBROUTINE ut_init_decomposition_1d(myindex, global_size, handle)
244 INTEGER,
INTENT(in) :: myindex(:)
245 INTEGER,
INTENT(in) :: global_size
246 INTEGER,
INTENT(out) :: handle
248 INTEGER(c_int) :: size_myindex_c
249 IF (huge(1_xt_int_kind) < huge(myindex))
THEN
250 IF (any(myindex > huge(1_xt_int_kind)) &
251 .OR. any(myindex < -huge(1_xt_int_kind))) &
252 CALL ut_abort(
'ut_init_decomposition_1d: index value not supported',&
255 IF (huge(
SIZE(myindex)) > huge(1_c_int))
THEN
256 IF (
SIZE(myindex) > huge(1_c_int)) &
257 CALL ut_abort(
'ut_init_decomposition_1: array size unsupported', &
260 size_myindex_c = int(
SIZE(myindex), c_int)
262 idx_vec_n=size_myindex_c)
264 END SUBROUTINE ut_init_decomposition_1d
267 INTEGER,
INTENT(in) :: handle
274 decomp_handle_out, mpi_world, comm_tmpl_handle, check_unique)
275 INTEGER,
INTENT(in) :: decomp_handle_in
276 INTEGER,
INTENT(in) :: decomp_handle_out
277 INTEGER,
INTENT(in) :: mpi_world
278 INTEGER,
INTENT(out) :: comm_tmpl_handle
279 LOGICAL,
OPTIONAL,
INTENT(in) :: check_unique
281 INTEGER :: icheck_unique
284 IF (
PRESENT(check_unique))
THEN
285 IF (check_unique) icheck_unique = 1
288 decomp_handle_in, decomp_handle_out, mpi_world, icheck_unique)
293 INTEGER,
INTENT(in) :: handle
299 SUBROUTINE ut_init_transposition_simple(comm_template_handle, &
300 datatype, comm_handle)
301 INTEGER,
INTENT(in) :: comm_template_handle
302 INTEGER,
INTENT(in) :: datatype
303 INTEGER,
INTENT(out) :: comm_handle
308 END SUBROUTINE ut_init_transposition_simple
310 SUBROUTINE ut_init_transposition_with_offsets(comm_template_handle, &
311 offset_in, offset_out, datatype_in, datatype_out, comm_handle)
312 INTEGER,
INTENT(in) :: comm_template_handle
313 INTEGER,
INTENT(in) :: offset_in(:)
314 INTEGER,
INTENT(in) :: offset_out(:)
315 INTEGER,
INTENT(in) :: datatype_in
316 INTEGER,
INTENT(in) :: datatype_out
317 INTEGER,
INTENT(out) :: comm_handle
321 IF (datatype_in /= datatype_out)
THEN
322 CALL ut_abort(
'ut_init_transposition: &
323 &(datatype_in /= datatype_out) not supported', &
327 datatype = datatype_in
330 & offset_in,
SIZE(offset_in), &
331 & offset_out,
SIZE(offset_out), &
334 END SUBROUTINE ut_init_transposition_with_offsets
337 INTEGER,
INTENT(in) :: handle
343 SUBROUTINE ut_transpose_int(field_in, transposition_handle, direction, &
345 INTEGER,
POINTER :: field_in, field_out
346 INTEGER,
INTENT(in) :: transposition_handle
347 INTEGER,
INTENT(in) :: direction
349 TYPE(c_ptr) :: pt_in, pt_out
351 pt_in = c_loc(field_in)
352 pt_out = c_loc(field_out)
355 END SUBROUTINE ut_transpose_int
integer, parameter, public xt_int_kind
integer, parameter xt_mpi_fint_kind
integer, parameter, public ut_mode_pack_alltoall
integer, parameter, public comm_forward
subroutine, public ut_init_oneway_transposition_template(decomp_handle_in, decomp_handle_out, mpi_world, comm_tmpl_handle, check_unique)
subroutine, public ut_finalize()
subroutine, public ut_init(decomp_size, comm_tmpl_size, comm_size, debug_lvl, mode, debug_unit)
integer, parameter, public comm_backward
subroutine, public ut_abort(msg, source, line)
subroutine, public ut_destroy_decomposition(handle)
subroutine, public ut_destroy_transposition_template(handle)
integer, parameter, public ut_mode_pack_p2p
integer, parameter, public ut_mode_dt_p2p
integer, parameter, public ut_mode_dt_alltoall
subroutine, public ut_destroy_transposition(handle)
void xt_ut_transpose(const void **pt_in, int itrans, int XT_UNUSED(direction), void **pt_out)
void xt_ut_destroy_transposition_template(int id)
void xt_ut_abort(char *msg, char *source, int *line) __attribute__((noreturn))
MPI_Fint xt_ut_init_transposition(MPI_Fint itemplate, MPI_Fint offset_in[], MPI_Fint XT_UNUSED(offset_in_size), MPI_Fint offset_out[], MPI_Fint XT_UNUSED(offset_out_size), MPI_Fint f_datatype)
MPI_Fint xt_ut_init_transposition_simple(MPI_Fint itemplate, MPI_Fint f_datatype)
void xt_ut_init(int decomp_size, int comm_tmpl_size, int comm_trans_size, int debug_lvl, int mode, int debug_unit)
MPI_Fint xt_ut_init_decomposition_1d(Xt_int *iv, int iv_n)
MPI_Fint xt_ut_init_oneway_transposition_template(int id_in, int id_out, int XT_UNUSED(mpi_world), int XT_UNUSED(icheck_unique))
void xt_ut_finalize(void)
void xt_ut_destroy_decomposition(int id)
void xt_ut_destroy_transposition(int id)