Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Sep 26, 2024
1 parent 62825b5 commit 426ceb2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f9bb0c90
67727d38
4 changes: 2 additions & 2 deletions search.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@
"href": "src/exercice.html#exercice",
"title": "Conclusion",
"section": "Exercice",
"text": "Exercice\nOn veut paralléliser l’exemple suivant avec Rmpi que j’ai trouvé ici\n# File name: loop_rowSums.r\n\nmy.loop <- 20\nm.dim <- list(nrow = 200000, ncol = 10)\nm <- matrix(1, nrow = m.dim$nrow, ncol = m.dim$ncol)\nret <- 0\n\nstart <- Sys.time()\nfor(k in 1 : my.loop){\n ret <- ret + sum(rowSums(m))\n}\ncat(ret, \"\\n\")\nSys.time() - start\n\nVoici la version MPMD venant de la même source, essayer d’en faire une version SPMD et comparer les performances.\n\nPouvez-vous réduire le nombre de messages ?\nVotre code est-il plus conçis ?\n\n# File name: rmpi_rowSums.r\n\nloop.fun <- function(){\n ##\n # Modify from loop_rowSums.r\n ##\n m.dim <- list(nrow = 200000, ncol = 10)\n m <- matrix(1, nrow = m.dim$nrow, ncol = m.dim$ncol)\n\n ret <- sum(rowSums(m))\n}\n\ncall.mpi.master <- function(){\n library(Rmpi)\n mpi.spawn.Rslaves(nslaves= 4, needlog = FALSE)\n mpi.bcast.Robj2slave(call.mpi.slave)\n mpi.bcast.cmd(call.mpi.slave())\n mpi.bcast.Robj(loop.fun)\n\n my.size <- mpi.universe.size()\n my.loop <- 20 \n my.split <- data.frame(loop = 1 : my.loop,\n rank = sort(c(rep(1 : my.size, my.loop %/% my.size),\n if(my.loop %% my.size > 0)\n (my.size : 2)[1 : (my.loop %% my.size)])))\n\n for(i in 1 : my.size){\n mpi.send.Robj(my.split$loop[my.split$rank == i], dest = i, tag = 1)\n }\n\n ret <- 0\n for(i in 1 : my.size){\n ret <- ret + mpi.recv(integer(1), type = 1, source = i, tag = 2)\n }\n ret\n}\n\ncall.mpi.slave <- function(){\n loop.fun <- eval(mpi.bcast.Robj())\n my.loop <- mpi.recv.Robj(source = 0, tag = 1)\n\n ret <- 0\n for(i in my.loop){\n ret <- ret + loop.fun()\n }\n mpi.send(as.integer(ret), type = 1, dest = 0, tag = 2)\n}\n\nstart <- Sys.time()\ncall.mpi.master()\nSys.time() - start"
"text": "Exercice\nOn veut paralléliser l’exemple suivant avec Rmpi que j’ai trouvé ici\n# File name: loop_rowSums.r\n\nmy.loop <- 20\nm.dim <- list(nrow = 200000, ncol = 10)\nm <- matrix(1, nrow = m.dim$nrow, ncol = m.dim$ncol)\nret <- 0\n\nstart <- Sys.time()\nfor(k in 1 : my.loop){\n ret <- ret + sum(rowSums(m))\n}\ncat(ret, \"\\n\")\nSys.time() - start\n\nVoici la version MPMD venant de la même source, essayer d’en faire une version SPMD et comparer les performances.\n\nPouvez-vous réduire le nombre de messages ?\nVotre code est-il plus conçis ?\n\n# File name: rmpi_rowSums.r\n\nloop.fun <- function(){\n m.dim <- list(nrow = 200000, ncol = 10)\n m <- matrix(1, nrow = m.dim$nrow, ncol = m.dim$ncol)\n\n ret <- sum(rowSums(m))\n}\n\ncall.mpi.master <- function(){\n library(Rmpi)\n mpi.spawn.Rslaves(nslaves= 4, needlog = FALSE)\n mpi.bcast.Robj2slave(call.mpi.slave)\n mpi.bcast.cmd(call.mpi.slave())\n mpi.bcast.Robj(loop.fun)\n\n my.size <- mpi.universe.size()\n my.loop <- 20 \n my.split <- data.frame(loop = 1 : my.loop,\n rank = sort(c(rep(1 : my.size, my.loop %/% my.size),\n if(my.loop %% my.size > 0)\n (my.size : 2)[1 : (my.loop %% my.size)])))\n\n for(i in 1 : my.size){\n mpi.send.Robj(my.split$loop[my.split$rank == i], dest = i, tag = 1)\n }\n\n ret <- 0\n for(i in 1 : my.size){\n ret <- ret + mpi.recv(integer(1), type = 1, source = i, tag = 2)\n }\n ret\n}\n\ncall.mpi.slave <- function(){\n loop.fun <- eval(mpi.bcast.Robj())\n my.loop <- mpi.recv.Robj(source = 0, tag = 1)\n\n ret <- 0\n for(i in my.loop){\n ret <- ret + loop.fun()\n }\n mpi.send(as.integer(ret), type = 1, dest = 0, tag = 2)\n}\n\nstart <- Sys.time()\ncall.mpi.master()\nSys.time() - start"
},
{
"objectID": "src/exercice.html#solution",
"href": "src/exercice.html#solution",
"title": "Conclusion",
"section": "Solution",
"text": "Solution\nlibrary(Rmpi)\n\nloop.fun <- function(){\n m.dim <- list(nrow = 200000, ncol = 10)\n m <- matrix(1, nrow = m.dim$nrow, ncol = m.dim$ncol)\n ret <- sum(rowSums(m))\n}\n\nmy.rank <- mpi.comm.rank(comm=0)\nmy.size <- mpi.comm.size(comm=0)\n\nmy.loop <- 20 \nmy.split <- .splitIndices(my.loop, my.size)\n\nmy.loop <- unlist(my.split[my.rank+1])\n\nret <- 0\nfor(i in my.loop){\n ret <- ret + loop.fun()\n}\n\nres <- mpi.reduce(as.integer(ret), type = 1, op = \"sum\", dest = 0, comm = 0)\n \nif (my.rank == 0 ) { cat(\"\\n\", res, \"\\n\") }\n\ninvisible(mpi.barrier(comm=0))\ninvisible(mpi.finalize())"
"text": "Solution\nlibrary(Rmpi)\n\nloop.fun <- function(){\n m.dim <- list(nrow = 200000, ncol = 10)\n m <- matrix(1, nrow = m.dim$nrow, ncol = m.dim$ncol)\n ret <- sum(rowSums(m))\n}\n\nmy.rank <- mpi.comm.rank(comm=0)\nmy.size <- mpi.comm.size(comm=0)\n\nmy.loop <- 20 \nmy.split <- .splitIndices(my.loop, my.size)\nmy.loop <- unlist(my.split[my.rank+1])\n\nret <- 0\nfor(i in my.loop){\n ret <- ret + loop.fun()\n}\n\nres <- mpi.reduce(as.integer(ret), type = 1, op = \"sum\", dest = 0, comm = 0)\n \nif (my.rank == 0 ) { cat(\"\\n res = \", res, \"\\n\") }\n\ninvisible(mpi.barrier(comm=0))\ninvisible(mpi.finalize())"
},
{
"objectID": "src/index.html",
Expand Down
8 changes: 4 additions & 4 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://groupecalcul.github.io/ANFRCalculRmpi/src/com_collectives.html</loc>
<lastmod>2024-09-26T13:50:41.145Z</lastmod>
<lastmod>2024-09-26T14:18:35.467Z</lastmod>
</url>
<url>
<loc>https://groupecalcul.github.io/ANFRCalculRmpi/src/exercice.html</loc>
<lastmod>2024-09-26T13:50:41.145Z</lastmod>
<lastmod>2024-09-26T14:18:35.467Z</lastmod>
</url>
<url>
<loc>https://groupecalcul.github.io/ANFRCalculRmpi/src/index.html</loc>
<lastmod>2024-09-26T13:50:41.147Z</lastmod>
<lastmod>2024-09-26T14:18:35.468Z</lastmod>
</url>
<url>
<loc>https://groupecalcul.github.io/ANFRCalculRmpi/src/com_point_a_point.html</loc>
<lastmod>2024-09-26T13:50:41.145Z</lastmod>
<lastmod>2024-09-26T14:18:35.467Z</lastmod>
</url>
</urlset>
Loading

0 comments on commit 426ceb2

Please sign in to comment.