33 INTEGER :: num_threads
39 INTEGER :: comm = mpi_comm_null
82 INTEGER,
INTENT(in) :: comm
90 REAL (rprec) :: start_time
98 CALL mpi_initialized(isinit, status)
100 IF (.not.isinit)
THEN
101 CALL mpi_init(status)
147 TYPE (bmw_parallel_context_class),
POINTER :: this
148 #if defined (MPI_OPT)
149 LOGICAL,
INTENT(in) :: finalize
158 #if defined (MPI_OPT)
160 CALL mpi_finalize(status)
181 INTEGER,
INTENT(in) :: status
184 #if defined (MPI_OPT)
185 CALL mpi_abort(mpi_comm_world, status, status)
209 TYPE (bmw_parallel_context_class),
INTENT(inout) :: this
210 INTEGER,
INTENT(in) :: num_threads
213 REAL (rprec) :: start_time
219 this%num_threads = num_threads
250 TYPE (bmw_parallel_context_class),
INTENT(inout) :: this
251 INTEGER,
INTENT(in) :: io_unit
254 REAL (rprec) :: start_time
259 IF (this%offset .eq. 0)
THEN
261 WRITE (io_unit,1000) this%stride
263 WRITE (io_unit,1001) this%num_threads
269 1000
FORMAT(
'Using ',i4,
' processes.')
270 #if defined (MPI_OPT)
271 1001
FORMAT(
'Using ',i4,
' threads per process.')
273 1001
FORMAT(
'Using ',i4,
' threads.')
288 USE stel_kinds,
ONLY: rprec
293 TYPE (bmw_parallel_context_class),
INTENT(in) :: this
294 REAL (rprec),
DIMENSION(:),
INTENT(inout) :: buffer
297 REAL (rprec) :: start_time
303 #if defined (MPI_OPT)
304 CALL mpi_allreduce(mpi_in_place, buffer,
SIZE(buffer), mpi_real8,
305 & mpi_sum, this%comm, status)
323 USE stel_kinds,
ONLY: rprec
328 TYPE (bmw_parallel_context_class),
INTENT(in) :: this
329 REAL (rprec),
DIMENSION(:,:),
INTENT(inout) :: buffer
332 REAL (rprec) :: start_time
338 #if defined (MPI_OPT)
339 CALL mpi_allreduce(mpi_in_place, buffer,
SIZE(buffer), mpi_real8,
340 & mpi_sum, this%comm, status)
358 USE stel_kinds,
ONLY: rprec
363 TYPE (bmw_parallel_context_class),
INTENT(in) :: this
364 REAL (rprec),
DIMENSION(:,:,:),
INTENT(inout) :: buffer
367 REAL (rprec) :: start_time
373 #if defined (MPI_OPT)
374 CALL mpi_allreduce(mpi_in_place, buffer,
SIZE(buffer), mpi_real8,
375 & mpi_sum, this%comm, status)
393 USE stel_kinds,
ONLY: rprec
398 TYPE (bmw_parallel_context_class),
INTENT(in) :: this
399 REAL (rprec),
DIMENSION(:,:,:,:),
INTENT(inout) :: buffer
402 REAL (rprec) :: start_time
408 #if defined (MPI_OPT)
409 CALL mpi_allreduce(mpi_in_place, buffer,
SIZE(buffer), mpi_real8,
410 & mpi_sum, this%comm, status)
435 INTEGER,
INTENT(in) :: total
438 INTEGER :: n_per_process
443 n_per_process = total/this%stride
446 n_left = mod(total, this%stride)
451 IF (this%offset .lt. n_left)
THEN
478 INTEGER,
INTENT(in) :: total
481 INTEGER :: n_per_process
486 n_per_process = total/this%stride
489 n_left = mod(total, this%stride)
494 IF (this%offset .lt. n_left)
THEN
520 INTEGER,
INTENT(in) :: index
521 INTEGER,
INTENT(in) :: num_i
545 INTEGER,
INTENT(in) :: index
546 INTEGER,
INTENT(in) :: num_i
547 INTEGER,
INTENT(in) :: num_j
571 INTEGER,
INTENT(in) :: index
572 INTEGER,
INTENT(in) :: num_i
573 INTEGER,
INTENT(in) :: num_j