Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New handshaking that allows sending data structure bigger than max integer #79

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ NeedsCompilation: yes
Maintainer: Wei-Chen Chen <wccsnow@gmail.com>
Repository: CRAN
Date/Publication: 2018-08-01 15:20:14 UTC
RoxygenNote: 6.1.1
44 changes: 32 additions & 12 deletions R/spmd_send.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
### Note: send/recv divides data in segments for data are too long.
### probe/count may not get the correct length if data are too long.

spmd.check.send <- function(obj,
obj.type,
rank.dest,
comm,
tag)
{
ct <- c(obj.type, length(obj))
.Call("spmd_send_double", as.numeric(ct), as.integer(rank.dest),
as.integer(tag), as.integer(comm), PACKAGE = "pbdMPI")
}

### Default method.
spmd.send.default <- function(x,
rank.dest = .pbd_env$SPMD.CT$rank.dest, tag = .pbd_env$SPMD.CT$tag,
Expand All @@ -12,10 +23,13 @@ spmd.send.default <- function(x,
### TODO: implement array/matrix as the way done in allreduce.
xx <- serialize(x, NULL) ### Serialize everything who calls default.
if(check.type){
ct <- c(.pbd_env$SPMD.DT$raw.object, length(xx))
.Call("spmd_send_integer", ct, as.integer(rank.dest),
as.integer(tag), as.integer(comm), PACKAGE = "pbdMPI")
spmd.check.send(xx,
obj.type = .pbd_env$SPMD.DT$raw.object,
rank.dest = rank.dest,
comm = comm,
tag = tag)
}

.Call("spmd_send_raw", xx, as.integer(rank.dest), as.integer(tag),
as.integer(comm), PACKAGE = "pbdMPI")
invisible()
Expand All @@ -28,9 +42,11 @@ spmd.send.integer <- function(x,
comm = .pbd_env$SPMD.CT$comm,
check.type = .pbd_env$SPMD.CT$check.type){
if(check.type){
ct <- as.double(c(.pbd_env$SPMD.DT$integer, length(x)))
.Call("spmd_send_double", ct, as.integer(rank.dest),
as.integer(tag), as.integer(comm), PACKAGE = "pbdMPI")
spmd.check.send(x,
obj.type = .pbd_env$SPMD.DT$integer,
rank.dest = rank.dest,
comm = comm,
tag = tag)
}
.Call("spmd_send_integer", x, as.integer(rank.dest), as.integer(tag),
as.integer(comm), PACKAGE = "pbdMPI")
Expand All @@ -42,9 +58,11 @@ spmd.send.double <- function(x,
comm = .pbd_env$SPMD.CT$comm,
check.type = .pbd_env$SPMD.CT$check.type){
if(check.type){
ct <- as.double(c(.pbd_env$SPMD.DT$double, length(x)))
.Call("spmd_send_double", ct, as.integer(rank.dest),
as.integer(tag), as.integer(comm), PACKAGE = "pbdMPI")
spmd.check.send(x,
obj.type = .pbd_env$SPMD.DT$double,
rank.dest = rank.dest,
comm = comm,
tag = tag)
}
.Call("spmd_send_double", x, as.integer(rank.dest), as.integer(tag),
as.integer(comm), PACKAGE = "pbdMPI")
Expand All @@ -56,9 +74,11 @@ spmd.send.raw <- function(x,
comm = .pbd_env$SPMD.CT$comm,
check.type = .pbd_env$SPMD.CT$check.type){
if(check.type){
ct <- as.double(c(.pbd_env$SPMD.DT$raw, length(x)))
.Call("spmd_send_double", ct, as.integer(rank.dest),
as.integer(tag), as.integer(comm), PACKAGE = "pbdMPI")
spmd.check.send(x,
obj.type = .pbd_env$SPMD.DT$raw,
rank.dest = rank.dest,
comm = comm,
tag = tag)
}
.Call("spmd_send_raw", x, as.integer(rank.dest), as.integer(tag),
as.integer(comm), PACKAGE = "pbdMPI")
Expand Down
Empty file modified inst/examples/test_long_vector/00_test_all.sh
100644 → 100755
Empty file.
Empty file modified inst/examples/test_long_vector/00_test_all.win
100644 → 100755
Empty file.
Empty file modified inst/examples/test_parallel/00_test_all.sh
100644 → 100755
Empty file.
Empty file modified inst/examples/test_parallel/00_test_all.win
100644 → 100755
Empty file.
Empty file modified inst/examples/test_performance/00_test_all.sh
100644 → 100755
Empty file.
Empty file modified inst/examples/test_performance/00_test_all.win
100644 → 100755
Empty file.
Empty file modified inst/examples/test_rmpi/00_test_all.sh
100644 → 100755
Empty file.
Empty file modified inst/examples/test_rmpi/00_test_spmd.win
100644 → 100755
Empty file.
Empty file modified inst/examples/test_s4/00_test_all.sh
100644 → 100755
Empty file.
Empty file modified inst/examples/test_s4/00_test_all.win
100644 → 100755
Empty file.
Empty file modified inst/examples/test_send_recv/00_test_all.sh
100644 → 100755
Empty file.
Empty file modified inst/examples/test_send_recv/00_test_all.win
100644 → 100755
Empty file.
Empty file modified inst/examples/test_spmd/00_test_all.sh
100644 → 100755
Empty file.
Empty file modified inst/examples/test_spmd/00_test_all.win
100644 → 100755
Empty file.