151 integer,
intent(in) :: tag
158 if (this%plan%nstage .gt. 0)
then
159 associate(st => this%plan%stage(1))
162 co = (st%dst_sel - 1) * this%plan%nwrk
163 if (st%src .ge. 0)
then
164 this%nrreq = this%nrreq + 1
165 call mpi_irecv(this%buf(co + st%nkw + 1), st%nrw, &
167 this%rreq(this%nrreq), ierr)
169 if (st%src2 .ge. 0)
then
170 this%nrreq = this%nrreq + 1
171 call mpi_irecv(this%buf(co + st%nkw + st%nrw + 1), st%nr2w, &
173 this%rreq(this%nrreq), ierr)
185 integer,
intent(in) :: n
186 real(kind=rp),
dimension(n),
intent(inout) :: u
187 integer,
intent(in) :: tag
188 type(c_ptr),
intent(inout) :: deps
189 type(c_ptr),
intent(inout) :: strm
190 integer :: j, co, ierr
192 if (this%plan%nstage .eq. 0)
return
194 associate(st => this%plan%stage(1))
195 co = (st%dst_sel - 1) * this%plan%nwrk
201 this%sbuf(j) = u(this%plan%pack_send_dof(j))
206 if (st%dst .ge. 0)
then
208 call mpi_isend(this%sbuf(1), st%nsw, mpi_real_precision, &
209 st%dst, tag, neko_comm, this%sreq(1), ierr)
217 this%buf(co + j) = u(this%plan%pack_keep_dof(j))
228 integer,
intent(in) :: n
229 real(kind=rp),
dimension(n),
intent(inout) :: u
230 type(c_ptr),
intent(inout) :: strm
232 integer :: s, i, j, co, so, fo, ierr
234 if (this%plan%nstage .eq. 0)
return
237 call mpi_waitall(this%nrreq, this%rreq, mpi_statuses_ignore, ierr)
238 call mpi_waitall(this%nsreq, this%sreq, mpi_statuses_ignore, ierr)
242 do s = 2, this%plan%nstage
243 associate(st => this%plan%stage(s))
244 so = (st%src_sel - 1) * this%plan%nwrk
245 co = (st%dst_sel - 1) * this%plan%nwrk
250 if (st%src .ge. 0)
then
251 this%nrreq = this%nrreq + 1
252 call mpi_irecv(this%buf(co + st%nkw + 1), st%nrw, &
253 mpi_real_precision, st%src, this%tag, neko_comm, &
254 this%rreq(this%nrreq), ierr)
256 if (st%src2 .ge. 0)
then
257 this%nrreq = this%nrreq + 1
258 call mpi_irecv(this%buf(co + st%nkw + st%nrw + 1), st%nr2w, &
259 mpi_real_precision, st%src2, this%tag, neko_comm, &
260 this%rreq(this%nrreq), ierr)
264 if (st%dst .ge. 0)
then
267 this%sbuf(j) = this%buf(so + st%send_idx(j))
272 call mpi_isend(this%sbuf(1), st%nsw, mpi_real_precision, &
273 st%dst, this%tag, neko_comm, this%sreq(1), ierr)
279 if (.not. st%inplace)
then
282 this%buf(co + j) = this%buf(so + st%keep_idx(j))
288 call mpi_waitall(this%nrreq, this%rreq, mpi_statuses_ignore, ierr)
289 call mpi_waitall(this%nsreq, this%sreq, mpi_statuses_ignore, ierr)
297 fo = (this%plan%final_sel - 1) * this%plan%nwrk
298 do i = 1, this%plan%nfinal_rec
299 associate(ro => this%plan%final_off(i), rl => this%plan%final_len(i))
309 u(this%plan%unpack_dof(ro + j)) = &
310 u(this%plan%unpack_dof(ro + j)) + this%buf(fo + ro + j)
321 u(this%plan%unpack_dof(ro + j)) = &
322 u(this%plan%unpack_dof(ro + j)) * this%buf(fo + ro + j)
333 u(this%plan%unpack_dof(ro + j)) = &
334 min(u(this%plan%unpack_dof(ro + j)), &
335 this%buf(fo + ro + j))
346 u(this%plan%unpack_dof(ro + j)) = &
347 max(u(this%plan%unpack_dof(ro + j)), &
348 this%buf(fo + ro + j))
352 call neko_error(
"Unknown operation in gs_crystal_nbwait")
362 integer,
intent(in) :: tag, nc
365 if (nc .gt. gs_vec_nc)
then
366 call neko_error(
'gs_crystal: too many components in vector exchange')
373 if (this%plan%nstage .gt. 0)
then
374 associate(st => this%plan%stage(1))
375 co = (st%dst_sel - 1) * nc * this%plan%nwrk
376 if (st%src .ge. 0)
then
377 this%nrreq = this%nrreq + 1
378 call mpi_irecv(this%buf_v(co + nc*st%nkw + 1), nc*st%nrw, &
379 mpi_real_precision, st%src, tag, neko_comm, &
380 this%rreq(this%nrreq), ierr)
382 if (st%src2 .ge. 0)
then
383 this%nrreq = this%nrreq + 1
384 call mpi_irecv(this%buf_v(co + nc*(st%nkw + st%nrw) + 1), &
385 nc*st%nr2w, mpi_real_precision, st%src2, tag, neko_comm, &
386 this%rreq(this%nrreq), ierr)
400 integer,
intent(in) :: n, nc
401 real(kind=rp),
dimension(nc*n),
intent(inout) :: u
402 integer,
intent(in) :: tag
403 type(c_ptr),
intent(inout) :: deps
404 type(c_ptr),
intent(inout) :: strm
405 integer :: j, c, co, ierr
407 if (this%plan%nstage .eq. 0)
return
409 associate(st => this%plan%stage(1))
410 co = (st%dst_sel - 1) * nc * this%plan%nwrk
415 this%sbuf_v(nc*(j-1) + c) = &
416 u((c-1)*n + this%plan%pack_send_dof(j))
422 if (st%dst .ge. 0)
then
424 call mpi_isend(this%sbuf_v(1), nc*st%nsw, mpi_real_precision, &
425 st%dst, tag, neko_comm, this%sreq(1), ierr)
432 this%buf_v(co + nc*(j-1) + c) = &
433 u((c-1)*n + this%plan%pack_keep_dof(j))
445 integer,
intent(in) :: n, nc
446 real(kind=rp),
dimension(nc*n),
intent(inout) :: u
447 type(c_ptr),
intent(inout) :: strm
449 integer :: s, i, j, c, co, so, fo, ierr
451 if (this%plan%nstage .eq. 0)
return
454 call mpi_waitall(this%nrreq, this%rreq, mpi_statuses_ignore, ierr)
455 call mpi_waitall(this%nsreq, this%sreq, mpi_statuses_ignore, ierr)
459 do s = 2, this%plan%nstage
460 associate(st => this%plan%stage(s))
461 so = (st%src_sel - 1) * nc * this%plan%nwrk
462 co = (st%dst_sel - 1) * nc * this%plan%nwrk
467 if (st%src .ge. 0)
then
468 this%nrreq = this%nrreq + 1
469 call mpi_irecv(this%buf_v(co + nc*st%nkw + 1), nc*st%nrw, &
470 mpi_real_precision, st%src, this%tag, neko_comm, &
471 this%rreq(this%nrreq), ierr)
473 if (st%src2 .ge. 0)
then
474 this%nrreq = this%nrreq + 1
475 call mpi_irecv(this%buf_v(co + nc*(st%nkw + st%nrw) + 1), &
476 nc*st%nr2w, mpi_real_precision, st%src2, this%tag, &
477 neko_comm, this%rreq(this%nrreq), ierr)
481 if (st%dst .ge. 0)
then
485 this%sbuf_v(nc*(j-1) + c) = &
486 this%buf_v(so + nc*(st%send_idx(j) - 1) + c)
492 call mpi_isend(this%sbuf_v(1), nc*st%nsw, mpi_real_precision, &
493 st%dst, this%tag, neko_comm, this%sreq(1), ierr)
497 if (.not. st%inplace)
then
501 this%buf_v(co + nc*(j-1) + c) = &
502 this%buf_v(so + nc*(st%keep_idx(j) - 1) + c)
509 call mpi_waitall(this%nrreq, this%rreq, mpi_statuses_ignore, ierr)
510 call mpi_waitall(this%nsreq, this%sreq, mpi_statuses_ignore, ierr)
516 fo = (this%plan%final_sel - 1) * nc * this%plan%nwrk
517 do i = 1, this%plan%nfinal_rec
518 associate(ro => this%plan%final_off(i), rl => this%plan%final_len(i))
524 u((c-1)*n + this%plan%unpack_dof(ro + j)) = &
525 u((c-1)*n + this%plan%unpack_dof(ro + j)) + &
526 this%buf_v(fo + nc*(ro + j - 1) + c)
534 u((c-1)*n + this%plan%unpack_dof(ro + j)) = &
535 u((c-1)*n + this%plan%unpack_dof(ro + j)) * &
536 this%buf_v(fo + nc*(ro + j - 1) + c)
544 u((c-1)*n + this%plan%unpack_dof(ro + j)) = &
545 min(u((c-1)*n + this%plan%unpack_dof(ro + j)), &
546 this%buf_v(fo + nc*(ro + j - 1) + c))
554 u((c-1)*n + this%plan%unpack_dof(ro + j)) = &
555 max(u((c-1)*n + this%plan%unpack_dof(ro + j)), &
556 this%buf_v(fo + nc*(ro + j - 1) + c))
561 call neko_error(
"Unknown operation in gs_crystal_nbwait_vec")