138 integer,
intent(in) :: tag
145 if (this%plan%nstage .gt. 0)
then
146 associate(st => this%plan%stage(1))
149 co = (st%dst_sel - 1) * this%plan%nwrk
150 if (st%src .ge. 0)
then
151 this%nrreq = this%nrreq + 1
152 call mpi_irecv(this%buf(co + st%nkw + 1), st%nrw, &
154 this%rreq(this%nrreq), ierr)
156 if (st%src2 .ge. 0)
then
157 this%nrreq = this%nrreq + 1
158 call mpi_irecv(this%buf(co + st%nkw + st%nrw + 1), st%nr2w, &
160 this%rreq(this%nrreq), ierr)
172 integer,
intent(in) :: n
173 real(kind=rp),
dimension(n),
intent(inout) :: u
174 integer,
intent(in) :: tag
175 type(c_ptr),
intent(inout) :: deps
176 type(c_ptr),
intent(inout) :: strm
177 integer :: j, co, ierr
179 if (this%plan%nstage .eq. 0)
return
181 associate(st => this%plan%stage(1))
182 co = (st%dst_sel - 1) * this%plan%nwrk
188 this%sbuf(j) = u(this%plan%pack_send_dof(j))
193 if (st%dst .ge. 0)
then
195 call mpi_isend(this%sbuf(1), st%nsw, mpi_real_precision, &
196 st%dst, tag, neko_comm, this%sreq(1), ierr)
204 this%buf(co + j) = u(this%plan%pack_keep_dof(j))
215 integer,
intent(in) :: n
216 real(kind=rp),
dimension(n),
intent(inout) :: u
217 type(c_ptr),
intent(inout) :: strm
219 integer :: s, i, j, co, so, fo, ierr
221 if (this%plan%nstage .eq. 0)
return
224 call mpi_waitall(this%nrreq, this%rreq, mpi_statuses_ignore, ierr)
225 call mpi_waitall(this%nsreq, this%sreq, mpi_statuses_ignore, ierr)
229 do s = 2, this%plan%nstage
230 associate(st => this%plan%stage(s))
231 so = (st%src_sel - 1) * this%plan%nwrk
232 co = (st%dst_sel - 1) * this%plan%nwrk
237 if (st%src .ge. 0)
then
238 this%nrreq = this%nrreq + 1
239 call mpi_irecv(this%buf(co + st%nkw + 1), st%nrw, &
240 mpi_real_precision, st%src, this%tag, neko_comm, &
241 this%rreq(this%nrreq), ierr)
243 if (st%src2 .ge. 0)
then
244 this%nrreq = this%nrreq + 1
245 call mpi_irecv(this%buf(co + st%nkw + st%nrw + 1), st%nr2w, &
246 mpi_real_precision, st%src2, this%tag, neko_comm, &
247 this%rreq(this%nrreq), ierr)
251 if (st%dst .ge. 0)
then
254 this%sbuf(j) = this%buf(so + st%send_idx(j))
259 call mpi_isend(this%sbuf(1), st%nsw, mpi_real_precision, &
260 st%dst, this%tag, neko_comm, this%sreq(1), ierr)
266 if (.not. st%inplace)
then
269 this%buf(co + j) = this%buf(so + st%keep_idx(j))
275 call mpi_waitall(this%nrreq, this%rreq, mpi_statuses_ignore, ierr)
276 call mpi_waitall(this%nsreq, this%sreq, mpi_statuses_ignore, ierr)
284 fo = (this%plan%final_sel - 1) * this%plan%nwrk
285 do i = 1, this%plan%nfinal_rec
286 associate(ro => this%plan%final_off(i), rl => this%plan%final_len(i))
296 u(this%plan%unpack_dof(ro + j)) = &
297 u(this%plan%unpack_dof(ro + j)) + this%buf(fo + ro + j)
308 u(this%plan%unpack_dof(ro + j)) = &
309 u(this%plan%unpack_dof(ro + j)) * this%buf(fo + ro + j)
320 u(this%plan%unpack_dof(ro + j)) = &
321 min(u(this%plan%unpack_dof(ro + j)), &
322 this%buf(fo + ro + j))
333 u(this%plan%unpack_dof(ro + j)) = &
334 max(u(this%plan%unpack_dof(ro + j)), &
335 this%buf(fo + ro + j))
339 call neko_error(
"Unknown operation in gs_crystal_nbwait")
349 integer,
intent(in) :: tag, nc
352 if (nc .gt. gs_vec_nc)
then
353 call neko_error(
'gs_crystal: too many components in vector exchange')
360 if (this%plan%nstage .gt. 0)
then
361 associate(st => this%plan%stage(1))
362 co = (st%dst_sel - 1) * nc * this%plan%nwrk
363 if (st%src .ge. 0)
then
364 this%nrreq = this%nrreq + 1
365 call mpi_irecv(this%buf_v(co + nc*st%nkw + 1), nc*st%nrw, &
366 mpi_real_precision, st%src, tag, neko_comm, &
367 this%rreq(this%nrreq), ierr)
369 if (st%src2 .ge. 0)
then
370 this%nrreq = this%nrreq + 1
371 call mpi_irecv(this%buf_v(co + nc*(st%nkw + st%nrw) + 1), &
372 nc*st%nr2w, mpi_real_precision, st%src2, tag, neko_comm, &
373 this%rreq(this%nrreq), ierr)
387 integer,
intent(in) :: n, nc
388 real(kind=rp),
dimension(nc*n),
intent(inout) :: u
389 integer,
intent(in) :: tag
390 type(c_ptr),
intent(inout) :: deps
391 type(c_ptr),
intent(inout) :: strm
392 integer :: j, c, co, ierr
394 if (this%plan%nstage .eq. 0)
return
396 associate(st => this%plan%stage(1))
397 co = (st%dst_sel - 1) * nc * this%plan%nwrk
402 this%sbuf_v(nc*(j-1) + c) = &
403 u((c-1)*n + this%plan%pack_send_dof(j))
409 if (st%dst .ge. 0)
then
411 call mpi_isend(this%sbuf_v(1), nc*st%nsw, mpi_real_precision, &
412 st%dst, tag, neko_comm, this%sreq(1), ierr)
419 this%buf_v(co + nc*(j-1) + c) = &
420 u((c-1)*n + this%plan%pack_keep_dof(j))
432 integer,
intent(in) :: n, nc
433 real(kind=rp),
dimension(nc*n),
intent(inout) :: u
434 type(c_ptr),
intent(inout) :: strm
436 integer :: s, i, j, c, co, so, fo, ierr
438 if (this%plan%nstage .eq. 0)
return
441 call mpi_waitall(this%nrreq, this%rreq, mpi_statuses_ignore, ierr)
442 call mpi_waitall(this%nsreq, this%sreq, mpi_statuses_ignore, ierr)
446 do s = 2, this%plan%nstage
447 associate(st => this%plan%stage(s))
448 so = (st%src_sel - 1) * nc * this%plan%nwrk
449 co = (st%dst_sel - 1) * nc * this%plan%nwrk
454 if (st%src .ge. 0)
then
455 this%nrreq = this%nrreq + 1
456 call mpi_irecv(this%buf_v(co + nc*st%nkw + 1), nc*st%nrw, &
457 mpi_real_precision, st%src, this%tag, neko_comm, &
458 this%rreq(this%nrreq), ierr)
460 if (st%src2 .ge. 0)
then
461 this%nrreq = this%nrreq + 1
462 call mpi_irecv(this%buf_v(co + nc*(st%nkw + st%nrw) + 1), &
463 nc*st%nr2w, mpi_real_precision, st%src2, this%tag, &
464 neko_comm, this%rreq(this%nrreq), ierr)
468 if (st%dst .ge. 0)
then
472 this%sbuf_v(nc*(j-1) + c) = &
473 this%buf_v(so + nc*(st%send_idx(j) - 1) + c)
479 call mpi_isend(this%sbuf_v(1), nc*st%nsw, mpi_real_precision, &
480 st%dst, this%tag, neko_comm, this%sreq(1), ierr)
484 if (.not. st%inplace)
then
488 this%buf_v(co + nc*(j-1) + c) = &
489 this%buf_v(so + nc*(st%keep_idx(j) - 1) + c)
496 call mpi_waitall(this%nrreq, this%rreq, mpi_statuses_ignore, ierr)
497 call mpi_waitall(this%nsreq, this%sreq, mpi_statuses_ignore, ierr)
503 fo = (this%plan%final_sel - 1) * nc * this%plan%nwrk
504 do i = 1, this%plan%nfinal_rec
505 associate(ro => this%plan%final_off(i), rl => this%plan%final_len(i))
511 u((c-1)*n + this%plan%unpack_dof(ro + j)) = &
512 u((c-1)*n + this%plan%unpack_dof(ro + j)) + &
513 this%buf_v(fo + nc*(ro + j - 1) + c)
521 u((c-1)*n + this%plan%unpack_dof(ro + j)) = &
522 u((c-1)*n + this%plan%unpack_dof(ro + j)) * &
523 this%buf_v(fo + nc*(ro + j - 1) + c)
531 u((c-1)*n + this%plan%unpack_dof(ro + j)) = &
532 min(u((c-1)*n + this%plan%unpack_dof(ro + j)), &
533 this%buf_v(fo + nc*(ro + j - 1) + c))
541 u((c-1)*n + this%plan%unpack_dof(ro + j)) = &
542 max(u((c-1)*n + this%plan%unpack_dof(ro + j)), &
543 this%buf_v(fo + nc*(ro + j - 1) + c))
548 call neko_error(
"Unknown operation in gs_crystal_nbwait_vec")