commits
Threads by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
July 2014
- 1 participants
- 63 discussions
[mpich] MPICH primary repository branch, master, updated. v3.1.1-114-gdd5c24d
by noreply@mpich.org 18 Jul '14
by noreply@mpich.org 18 Jul '14
18 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via dd5c24d7a3c3e90081be65e2e1424c46cdf18586 (commit)
via 67aa8e6a387de0e31982b57ba5099e12c78eb92e (commit)
from cb1fa5f8e843dddceed61d886d382c126f198ac3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/dd5c24d7a3c3e90081be65e2e1424c46c…
commit dd5c24d7a3c3e90081be65e2e1424c46cdf18586
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Fri Jul 11 10:40:55 2014 -0500
Added a test for MPI_T cvar read and write
See #2128
Signed-off-by: Huiwei Lu <huiweilu(a)mcs.anl.gov>
diff --git a/test/mpi/.gitignore b/test/mpi/.gitignore
index 5966d8f..3a62aca 100644
--- a/test/mpi/.gitignore
+++ b/test/mpi/.gitignore
@@ -892,6 +892,7 @@
/manual/testconnectserial
/mpi_t/mpi_t_str
/mpi_t/mpit_vars
+/mpi_t/cvarwrite
/perf/allredtrace
/perf/commcreatep
/perf/dtpack
diff --git a/test/mpi/mpi_t/Makefile.am b/test/mpi/mpi_t/Makefile.am
index 7e0b5b7..95088d7 100644
--- a/test/mpi/mpi_t/Makefile.am
+++ b/test/mpi/mpi_t/Makefile.am
@@ -14,4 +14,5 @@ EXTRA_DIST = testlist
## correctly
noinst_PROGRAMS = \
mpi_t_str \
- mpit_vars
+ mpit_vars \
+ cvarwrite
diff --git a/test/mpi/mpi_t/cvarwrite.c b/test/mpi/mpi_t/cvarwrite.c
new file mode 100644
index 0000000..aaf84d2
--- /dev/null
+++ b/test/mpi/mpi_t/cvarwrite.c
@@ -0,0 +1,107 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ * (C) 2014 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+#include "mpi.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "mpitest.h"
+#include "mpitestconf.h"
+
+#define MAX_STR_CVAR_LEN 512
+#define MAX_VAR_NAME_LEN 128
+
+int main(int argc, char* argv[])
+{
+ int i;
+ int required, provided;
+ int num_cvar;
+ char name[MAX_VAR_NAME_LEN];
+ int namelen, verbosity, datatype, desclen, binding, scope, count;
+ MPI_T_enum enumtype = MPI_T_ENUM_NULL;
+ int iin, iout, iold;
+ unsigned uin, uout, uold;
+ unsigned long ulin, ulout, ulold;
+ unsigned long long ullin, ullout, ullold;
+ char cin[MAX_STR_CVAR_LEN], cout[MAX_STR_CVAR_LEN], cold[MAX_STR_CVAR_LEN];
+ MPI_T_cvar_handle chandle;
+ int errs = 0;
+
+ required = MPI_THREAD_SINGLE;
+ namelen = sizeof(name);
+
+ MTest_Init(&argc, &argv);
+ MPI_T_init_thread(required, &provided);
+
+ MPI_T_cvar_get_num(&num_cvar);
+ MTestPrintfMsg(10, "Total %d MPI control variables\n", num_cvar);
+
+ for (i = 0; i < num_cvar; i++) {
+ MPI_T_cvar_get_info(i, name, &namelen, &verbosity, &datatype, &enumtype,
+ NULL /* desc is intentionly ignored to test NULL input */, &desclen, &binding, &scope);
+ if (binding != MPI_T_BIND_NO_OBJECT) continue;
+
+ MPI_T_cvar_handle_alloc(i, NULL, &chandle, &count);
+ if (count == 1 || (datatype == MPI_CHAR && count < sizeof(cin))) {
+ switch (datatype) {
+ case MPI_INT:
+ iin = 123;
+ iout = 456;
+ MPI_T_cvar_read(chandle, &iold); /* Read the old value */
+ MPI_T_cvar_write(chandle, &iin); /* Write an arbitrary value */
+ MPI_T_cvar_read(chandle, &iout); /* Read the value again */
+ MPI_T_cvar_write(chandle, &iold); /* Restore the old value */
+ if (iin != iout) errs++;
+ break;
+ case MPI_UNSIGNED:
+ uin = 133;
+ uout = 986;
+ MPI_T_cvar_read(chandle, &uold);
+ MPI_T_cvar_write(chandle, &uin);
+ MPI_T_cvar_read(chandle, &uout);
+ MPI_T_cvar_write(chandle, &uold);
+ if (uin != uout) errs++;
+ break;
+ case MPI_UNSIGNED_LONG:
+ ulin = 1830;
+ ulout = 2014;
+ MPI_T_cvar_read(chandle, &ulold);
+ MPI_T_cvar_write(chandle, &ulin);
+ MPI_T_cvar_read(chandle, &ulout);
+ MPI_T_cvar_write(chandle, &ulold);
+ if (ulin != ulout) errs++;
+ break;
+ case MPI_UNSIGNED_LONG_LONG:
+ ullin = 11930;
+ ullout = 52014;
+ MPI_T_cvar_read(chandle, &ullold);
+ MPI_T_cvar_write(chandle, &ullin);
+ MPI_T_cvar_read(chandle, &ullout);
+ MPI_T_cvar_write(chandle, &ullold);
+ if (ullin != ullout) errs++;
+ break;
+ case MPI_CHAR:
+ strcpy(cin, "GARBAGE MPI_CHAR CVAR VALUE");
+ strcpy(cout, "TEMPORARY MPI_CHAR CVAR VALUE");
+ MPI_T_cvar_read(chandle, cold);
+ MPI_T_cvar_write(chandle, cin);
+ MPI_T_cvar_read(chandle, cout);
+ MPI_T_cvar_write(chandle, cold);
+ /* printf("%s = %s\n", name, cold); */
+ if (strcmp(cin, cout)) errs++;
+ break;
+ default:
+ break;
+ }
+ }
+
+ MPI_T_cvar_handle_free(&chandle);
+ }
+
+ MPI_T_finalize();
+ MTest_Finalize(errs);
+ MPI_Finalize();
+ return 0;
+}
diff --git a/test/mpi/mpi_t/testlist b/test/mpi/mpi_t/testlist
index 69fcab4..f6e3e6a 100644
--- a/test/mpi/mpi_t/testlist
+++ b/test/mpi/mpi_t/testlist
@@ -1,2 +1,3 @@
mpi_t_str 1 mpiversion=3.0
mpit_vars 1 mpiversion=3.0
+cvarwrite 1 mpiversion=3.0
http://git.mpich.org/mpich.git/commitdiff/67aa8e6a387de0e31982b57ba5099e12c…
commit 67aa8e6a387de0e31982b57ba5099e12c78eb92e
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Tue Jul 8 13:54:03 2014 -0500
Added the missing const to the buf arg in MPI_T_pvar/cvar_write
Fixes #2128
Signed-off-by: Huiwei Lu <huiweilu(a)mcs.anl.gov>
diff --git a/src/include/mpi.h.in b/src/include/mpi.h.in
index 72bbf04..bd047ce 100644
--- a/src/include/mpi.h.in
+++ b/src/include/mpi.h.in
@@ -1501,7 +1501,7 @@ int MPI_T_cvar_handle_alloc(int cvar_index, void *obj_handle, MPI_T_cvar_handle
int *count);
int MPI_T_cvar_handle_free(MPI_T_cvar_handle *handle);
int MPI_T_cvar_read(MPI_T_cvar_handle handle, void *buf);
-int MPI_T_cvar_write(MPI_T_cvar_handle handle, void *buf);
+int MPI_T_cvar_write(MPI_T_cvar_handle handle, const void *buf);
int MPI_T_pvar_get_num(int *num_pvar);
int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosity, int *var_class,
MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc, int *desc_len,
@@ -1514,7 +1514,7 @@ int MPI_T_pvar_handle_free(MPI_T_pvar_session session, MPI_T_pvar_handle *handle
int MPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int MPI_T_pvar_stop(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int MPI_T_pvar_read(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
-int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
+int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf);
int MPI_T_pvar_reset(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int MPI_T_pvar_readreset(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
int MPI_T_category_get_num(int *num_cat);
@@ -2136,7 +2136,7 @@ int PMPI_T_cvar_handle_alloc(int cvar_index, void *obj_handle, MPI_T_cvar_handle
int *count);
int PMPI_T_cvar_handle_free(MPI_T_cvar_handle *handle);
int PMPI_T_cvar_read(MPI_T_cvar_handle handle, void *buf);
-int PMPI_T_cvar_write(MPI_T_cvar_handle handle, void *buf);
+int PMPI_T_cvar_write(MPI_T_cvar_handle handle, const void *buf);
int PMPI_T_pvar_get_num(int *num_pvar);
int PMPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosity, int *var_class,
MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc, int *desc_len,
@@ -2149,7 +2149,7 @@ int PMPI_T_pvar_handle_free(MPI_T_pvar_session session, MPI_T_pvar_handle *handl
int PMPI_T_pvar_start(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int PMPI_T_pvar_stop(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int PMPI_T_pvar_read(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
-int PMPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
+int PMPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf);
int PMPI_T_pvar_reset(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int PMPI_T_pvar_readreset(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
int PMPI_T_category_get_num(int *num_cat);
diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index ccbe9a7..b07f448 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -4214,7 +4214,7 @@ int MPIR_Ialltoallw_inter(const void *sendbuf, const int *sendcounts, const int
/* begin impl functions for MPI_T (MPI_T_ right now) */
int MPIR_T_cvar_handle_alloc_impl(int cvar_index, void *obj_handle, MPI_T_cvar_handle *handle, int *count);
int MPIR_T_cvar_read_impl(MPI_T_cvar_handle handle, void *buf);
-int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, void *buf);
+int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, const void *buf);
int MPIR_T_pvar_session_create_impl(MPI_T_pvar_session *session);
int MPIR_T_pvar_session_free_impl(MPI_T_pvar_session *session);
int MPIR_T_pvar_handle_alloc_impl(MPI_T_pvar_session session, int pvar_index, void *obj_handle, MPI_T_pvar_handle *handle, int *count);
@@ -4222,7 +4222,7 @@ int MPIR_T_pvar_handle_free_impl(MPI_T_pvar_session session, MPI_T_pvar_handle *
int MPIR_T_pvar_start_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int MPIR_T_pvar_stop_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int MPIR_T_pvar_read_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
-int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
+int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf);
int MPIR_T_pvar_reset_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle);
int MPIR_T_pvar_readreset_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf);
int MPIR_T_category_get_cvars_impl(int cat_index, int len, int indices[]);
diff --git a/src/mpi_t/cvar_write.c b/src/mpi_t/cvar_write.c
index b88959e..fb57a47 100644
--- a/src/mpi_t/cvar_write.c
+++ b/src/mpi_t/cvar_write.c
@@ -30,7 +30,7 @@ int MPI_T_cvar_write(MPI_T_cvar_handle handle, void *buf) __attribute__((weak,al
#define FUNCNAME MPIR_T_cvar_write_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
-int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, void *buf)
+int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, const void *buf)
{
int mpi_errno = MPI_SUCCESS;
int i, count;
@@ -108,7 +108,7 @@ Input Parameters:
.N MPI_T_ERR_CVAR_SET_NOT_NOW
.N MPI_T_ERR_CVAR_SET_NEVER
@*/
-int MPI_T_cvar_write(MPI_T_cvar_handle handle, void *buf)
+int MPI_T_cvar_write(MPI_T_cvar_handle handle, const void *buf)
{
int mpi_errno = MPI_SUCCESS;
diff --git a/src/mpi_t/pvar_write.c b/src/mpi_t/pvar_write.c
index 23ff0e2..ca3997b 100644
--- a/src/mpi_t/pvar_write.c
+++ b/src/mpi_t/pvar_write.c
@@ -30,7 +30,7 @@ int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void
#define FUNCNAME MPIR_T_pvar_write_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
-int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf)
+int MPIR_T_pvar_write_impl(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf)
{
/* This function should never be called */
return MPI_ERR_INTERN;
@@ -70,7 +70,7 @@ MPI_T_pvar_write().
.N MPI_T_ERR_INVALID_HANDLE
.N MPI_T_ERR_PVAR_NO_WRITE
@*/
-int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, void *buf)
+int MPI_T_pvar_write(MPI_T_pvar_session session, MPI_T_pvar_handle handle, const void *buf)
{
int mpi_errno = MPI_SUCCESS;
-----------------------------------------------------------------------
Summary of changes:
src/include/mpi.h.in | 8 ++--
src/include/mpiimpl.h | 4 +-
src/mpi_t/cvar_write.c | 4 +-
src/mpi_t/pvar_write.c | 4 +-
test/mpi/.gitignore | 1 +
test/mpi/mpi_t/Makefile.am | 3 +-
test/mpi/mpi_t/cvarwrite.c | 107 ++++++++++++++++++++++++++++++++++++++++++++
test/mpi/mpi_t/testlist | 1 +
8 files changed, 121 insertions(+), 11 deletions(-)
create mode 100644 test/mpi/mpi_t/cvarwrite.c
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-112-gcb1fa5f
by noreply@mpich.org 17 Jul '14
by noreply@mpich.org 17 Jul '14
17 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via cb1fa5f8e843dddceed61d886d382c126f198ac3 (commit)
from 274a5a70275081880d29f149ff0a24cc5ad9c8c3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/cb1fa5f8e843dddceed61d886d382c126…
commit cb1fa5f8e843dddceed61d886d382c126f198ac3
Author: Sangmin Seo <sseo(a)anl.gov>
Date: Fri Jul 11 11:15:10 2014 -0500
Add environment variables to control memory tracing overhead.
When the memory overhead for memory usage tracing is bigger than
the threshold value, a warning message is generated to indicate the
amount of the memory used in the tracing. Environment variables
to control the threshold value were added.
See #2068.
Signed-off-by: Pavan Balaji <balaji(a)anl.gov>
diff --git a/src/mpl/include/mpltrmem.h b/src/mpl/include/mpltrmem.h
index 5f64f3e..4253bac 100644
--- a/src/mpl/include/mpltrmem.h
+++ b/src/mpl/include/mpltrmem.h
@@ -24,7 +24,6 @@ void *MPL_trcalloc(size_t, size_t, int, const char[]);
void *MPL_trrealloc(void *, size_t, int, const char[]);
void *MPL_trstrdup(const char *, int, const char[]);
void MPL_TrSetMaxMem(size_t);
-void MPL_TrSetMaxAlloc(size_t);
/* Make sure that FILE is defined */
#include <stdio.h>
diff --git a/src/mpl/src/mpltrmem.c b/src/mpl/src/mpltrmem.c
index 5616542..3c9686f 100644
--- a/src/mpl/src/mpltrmem.c
+++ b/src/mpl/src/mpltrmem.c
@@ -127,8 +127,8 @@ static int TRSetBytes = 0;
/* Used to keep track of allocations */
static volatile size_t TRMaxMem = 0;
static volatile int TRMaxMemId = 0;
-static volatile size_t TRNumAlloc = 0;
-static volatile size_t TRMaxAlloc = (size_t)2E6;
+static volatile size_t TRCurOverhead = 0;
+static volatile size_t TRMaxOverhead = 314572800;
/* Used to limit allocation */
static volatile size_t TRMaxMemAllow = 0;
@@ -180,6 +180,11 @@ void MPL_trinit(int rank)
TRDefaultByte = 0;
TRFreedByte = 0;
}
+ s = getenv("MPICH_TRMEM_MAX_OVERHEAD");
+ if (s && *s) {
+ long l = atol(s);
+ TRMaxOverhead = (size_t)l;
+ }
s = getenv("MPL_TRMEM_INIT");
if (s && *s && (strcmp(s, "YES") == 0 || strcmp(s, "yes") == 0)) {
TRSetBytes = 1;
@@ -198,6 +203,11 @@ void MPL_trinit(int rank)
int l = atoi(s);
TRlevel = l;
}
+ s = getenv("MPL_TRMEM_MAX_OVERHEAD");
+ if (s && *s) {
+ long l = atol(s);
+ TRMaxOverhead = (size_t)l;
+ }
}
@@ -288,14 +298,13 @@ void *MPL_trmalloc(size_t a, int lineno, const char fname[])
world_rank, (long)a, (long)nsize, new, fname, lineno);
}
- /* Warn the user about tracing overhead if the total number of memory
- * allocation is larger than the threshold, TRMaxAlloc. */
- TRNumAlloc++;
- if (TRNumAlloc >= TRMaxAlloc) {
+ /* Warn the user about tracing overhead if the total memory overhead for
+ * tracing is larger than the threshold, TRMaxOverhead. */
+ TRCurOverhead += sizeof(TrSPACE);
+ if ((TRCurOverhead > TRMaxOverhead) && TRMaxOverhead) {
MPL_error_printf("[%d] %.1lf MB was used for memory usage tracing!\n",
- world_rank,
- (double)(sizeof(TrSPACE) * TRNumAlloc) / 1024 / 1024);
- MPL_TrSetMaxAlloc((size_t)(TRMaxAlloc + 1E6));
+ world_rank, (double)TRCurOverhead / 1024 / 1024);
+ TRMaxOverhead = TRMaxOverhead * 2;
}
/* Without these macros valgrind actually catches far fewer errors when
@@ -439,7 +448,7 @@ void MPL_trfree(void *a_ptr, int line, const char file[])
file, line);
}
- TRNumAlloc--;
+ TRCurOverhead -= sizeof(TrSPACE);
/*
* Now, scrub the data (except possibly the first few ints) to
@@ -1040,11 +1049,6 @@ void MPL_TrSetMaxMem(size_t size)
TRMaxMemAllow = size;
}
-void MPL_TrSetMaxAlloc(size_t size)
-{
- TRMaxAlloc = size;
-}
-
static void addrToHex(void *addr, char string[MAX_ADDRESS_CHARS])
{
int i;
-----------------------------------------------------------------------
Summary of changes:
src/mpl/include/mpltrmem.h | 1 -
src/mpl/src/mpltrmem.c | 34 +++++++++++++++++++---------------
2 files changed, 19 insertions(+), 16 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-111-g274a5a7
by noreply@mpich.org 17 Jul '14
by noreply@mpich.org 17 Jul '14
17 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 274a5a70275081880d29f149ff0a24cc5ad9c8c3 (commit)
from 006a54bd1d330d16f9491dbd59dd3e8486cf7ae2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/274a5a70275081880d29f149ff0a24cc5…
commit 274a5a70275081880d29f149ff0a24cc5ad9c8c3
Author: Pavan Balaji <balaji(a)anl.gov>
Date: Wed Jul 16 22:31:07 2014 -0500
Simplified RMA_Op structure.
We were creating duplicating information in the operation structure
and in the packet structure when the message is actually issued.
Since most of the information is the same anyway, this patch just
embeds a packet structure into the operation structure.
Signed-off-by: Xin Zhao <xinzhao3(a)illinois.edu>
diff --git a/src/mpid/ch3/include/mpidpkt.h b/src/mpid/ch3/include/mpidpkt.h
index 935c03b..65b7bde 100644
--- a/src/mpid/ch3/include/mpidpkt.h
+++ b/src/mpid/ch3/include/mpidpkt.h
@@ -62,7 +62,7 @@ typedef union {
such as different RMA types. */
enum MPIDI_CH3_Pkt_types
{
- MPIDI_CH3_PKT_EAGER_SEND = 0,
+ MPIDI_CH3_PKT_EAGER_SEND = 53,
#if defined(USE_EAGER_SHORT)
MPIDI_CH3_PKT_EAGERSHORT_SEND,
#endif /* defined(USE_EAGER_SHORT) */
@@ -197,6 +197,43 @@ MPIDI_CH3_Pkt_cancel_send_resp_t;
MPIDI_CH3_PKT_DEFS
#endif
+#define MPIDI_CH3_PKT_RMA_GET_TARGET_DATATYPE(pkt_, datatype_) \
+ { \
+ switch(pkt_.type) { \
+ case (MPIDI_CH3_PKT_PUT): \
+ { \
+ MPIDI_CH3_Pkt_put_t put_pkt_ = pkt_.put; \
+ datatype_ = put_pkt_.datatype; \
+ break; \
+ } \
+ case (MPIDI_CH3_PKT_GET): \
+ { \
+ MPIDI_CH3_Pkt_get_t get_pkt_ = pkt_.get; \
+ datatype_ = get_pkt_.datatype; \
+ break; \
+ } \
+ case (MPIDI_CH3_PKT_ACCUMULATE): \
+ case (MPIDI_CH3_PKT_GET_ACCUM): \
+ { \
+ MPIDI_CH3_Pkt_accum_t acc_pkt_ = pkt_.accum; \
+ datatype_ = acc_pkt_.datatype; \
+ break; \
+ } \
+ case (MPIDI_CH3_PKT_CAS): \
+ { \
+ MPIDI_CH3_Pkt_cas_t cas_pkt_ = pkt_.cas; \
+ datatype_ = cas_pkt_.datatype; \
+ break; \
+ } \
+ case (MPIDI_CH3_PKT_FOP): \
+ { \
+ MPIDI_CH3_Pkt_fop_t fop_pkt_ = pkt_.fop; \
+ datatype_ = fop_pkt_.datatype; \
+ break; \
+ } \
+ } \
+ }
+
typedef struct MPIDI_CH3_Pkt_put
{
MPIDI_CH3_Pkt_type_t type;
@@ -296,6 +333,7 @@ typedef struct MPIDI_CH3_Pkt_cas
MPI_Datatype datatype;
void *addr;
MPI_Request request_handle;
+ MPI_Win source_win_handle;
MPI_Win target_win_handle; /* Used in the last RMA operation in each
* epoch for decrementing rma op counter in
* active target rma and for unlocking window
@@ -321,6 +359,7 @@ typedef struct MPIDI_CH3_Pkt_fop
void *addr;
MPI_Op op;
MPI_Request request_handle;
+ MPI_Win source_win_handle;
MPI_Win target_win_handle; /* Used in the last RMA operation in each
* epoch for decrementing rma op counter in
* active target rma and for unlocking window
diff --git a/src/mpid/ch3/include/mpidrma.h b/src/mpid/ch3/include/mpidrma.h
index 84bac45..38c9ee4 100644
--- a/src/mpid/ch3/include/mpidrma.h
+++ b/src/mpid/ch3/include/mpidrma.h
@@ -13,17 +13,6 @@ MPIR_T_PVAR_DOUBLE_TIMER_DECL_EXTERN(RMA, rma_wincreate_allgather);
MPIR_T_PVAR_DOUBLE_TIMER_DECL_EXTERN(RMA, rma_winfree_rs);
MPIR_T_PVAR_DOUBLE_TIMER_DECL_EXTERN(RMA, rma_winfree_complete);
-typedef enum MPIDI_RMA_Op_type {
- MPIDI_RMA_PUT = 23,
- MPIDI_RMA_GET = 24,
- MPIDI_RMA_ACCUMULATE = 25,
- /* REMOVED: MPIDI_RMA_LOCK = 26, */
- MPIDI_RMA_ACC_CONTIG = 27,
- MPIDI_RMA_GET_ACCUMULATE = 28,
- MPIDI_RMA_COMPARE_AND_SWAP = 29,
- MPIDI_RMA_FETCH_AND_OP = 30
-} MPIDI_RMA_Op_type_t;
-
/* Special case RMA operations */
enum MPIDI_RMA_Datatype {
@@ -62,33 +51,29 @@ typedef struct MPIDI_RMA_dtype_info { /* for derived datatypes */
typedef struct MPIDI_RMA_Op {
struct MPIDI_RMA_Op *prev; /* pointer to next element in list */
struct MPIDI_RMA_Op *next; /* pointer to next element in list */
- /* FIXME: It would be better to setup the packet that will be sent, at
- least in most cases (if, as a result of the sync/ops/sync sequence,
- a different packet type is needed, it can be extracted from the
- information otherwise stored). */
- MPIDI_RMA_Op_type_t type;
+
void *origin_addr;
int origin_count;
MPI_Datatype origin_datatype;
- int target_rank;
- MPI_Aint target_disp;
- int target_count;
- MPI_Datatype target_datatype;
- MPI_Op op; /* for accumulate */
- /* Used to complete operations */
- struct MPID_Request *request;
- MPIDI_RMA_dtype_info dtype_info;
- void *dataloop;
+
+ void *compare_addr;
+ MPI_Datatype compare_datatype;
+
void *result_addr;
int result_count;
MPI_Datatype result_datatype;
- void *compare_addr;
- int compare_count;
- MPI_Datatype compare_datatype;
+
+ struct MPID_Request *request;
+ MPIDI_RMA_dtype_info dtype_info;
+ void *dataloop;
+
+ int target_rank;
+
+ MPIDI_CH3_Pkt_t pkt;
} MPIDI_RMA_Op_t;
typedef struct MPIDI_PT_single_op {
- int type; /* put, get, or accum. */
+ enum MPIDI_CH3_Pkt_types type; /* put, get, or accum. */
void *addr;
int count;
MPI_Datatype datatype;
diff --git a/src/mpid/ch3/src/ch3u_handle_recv_req.c b/src/mpid/ch3/src/ch3u_handle_recv_req.c
index 4d07c94..8c44d26 100644
--- a/src/mpid/ch3/src/ch3u_handle_recv_req.c
+++ b/src/mpid/ch3/src/ch3u_handle_recv_req.c
@@ -961,7 +961,7 @@ int MPIDI_CH3I_Release_lock(MPID_Win *win_ptr)
MPIDI_PT_single_op * single_op;
single_op = lock_queue->pt_single_op;
- if (single_op->type == MPIDI_RMA_PUT) {
+ if (single_op->type == MPIDI_CH3_PKT_LOCK_PUT_UNLOCK) {
mpi_errno = MPIR_Localcopy(single_op->data,
single_op->count,
single_op->datatype,
@@ -969,21 +969,21 @@ int MPIDI_CH3I_Release_lock(MPID_Win *win_ptr)
single_op->count,
single_op->datatype);
}
- else if (single_op->type == MPIDI_RMA_ACCUMULATE) {
+ else if (single_op->type == MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK) {
if (win_ptr->shm_allocated == TRUE)
MPIDI_CH3I_SHM_MUTEX_LOCK(win_ptr);
mpi_errno = do_simple_accumulate(single_op);
if (win_ptr->shm_allocated == TRUE)
MPIDI_CH3I_SHM_MUTEX_UNLOCK(win_ptr);
}
- else if (single_op->type == MPIDI_RMA_GET) {
+ else if (single_op->type == MPIDI_CH3_PKT_LOCK_GET_UNLOCK) {
mpi_errno = do_simple_get(win_ptr, lock_queue);
}
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
/* if put or accumulate, send rma done packet and release lock. */
- if (single_op->type != MPIDI_RMA_GET) {
+ if (single_op->type != MPIDI_CH3_PKT_LOCK_GET_UNLOCK) {
/* NOTE: Only *queued* single_op operations are completed here.
Lock-op-unlock/single_op RMA ops can also be completed as
they arrive within various packet/request handlers via
diff --git a/src/mpid/ch3/src/ch3u_rma_acc_ops.c b/src/mpid/ch3/src/ch3u_rma_acc_ops.c
index b0b5e54..182dec8 100644
--- a/src/mpid/ch3/src/ch3u_rma_acc_ops.c
+++ b/src/mpid/ch3/src/ch3u_rma_acc_ops.c
@@ -86,20 +86,46 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
/* TODO: Can we use the MPIDI_RMA_ACC_CONTIG optimization? */
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
- new_ptr->type = MPIDI_RMA_GET_ACCUMULATE;
- /* Cast away const'ness for origin_address as MPIDI_RMA_Op_t
- * contain both PUT and GET like ops */
- new_ptr->origin_addr = (void *) origin_addr;
- new_ptr->origin_count = origin_count;
- new_ptr->origin_datatype = origin_datatype;
- new_ptr->result_addr = result_addr;
- new_ptr->result_count = result_count;
- new_ptr->result_datatype = result_datatype;
- new_ptr->target_rank = target_rank;
- new_ptr->target_disp = target_disp;
- new_ptr->target_count = target_count;
- new_ptr->target_datatype = target_datatype;
- new_ptr->op = op;
+
+ if (op == MPI_NO_OP) {
+ /* Convert GAcc to a Get */
+ MPIDI_CH3_Pkt_get_t *get_pkt = &(new_ptr->pkt.get);
+ MPIDI_Pkt_init(get_pkt, MPIDI_CH3_PKT_GET);
+ get_pkt->addr = (char *) win_ptr->base_addrs[target_rank] +
+ win_ptr->disp_units[target_rank] * target_disp;
+ get_pkt->count = target_count;
+ get_pkt->datatype = target_datatype;
+ get_pkt->dataloop_size = 0;
+ get_pkt->target_win_handle = win_ptr->all_win_handles[target_rank];
+ get_pkt->source_win_handle = win_ptr->handle;
+
+ new_ptr->origin_addr = result_addr;
+ new_ptr->origin_count = result_count;
+ new_ptr->origin_datatype = result_datatype;
+ new_ptr->target_rank = target_rank;
+ }
+
+ else {
+ MPIDI_CH3_Pkt_accum_t *accum_pkt = &(new_ptr->pkt.accum);
+ MPIDI_Pkt_init(accum_pkt, MPIDI_CH3_PKT_GET_ACCUM);
+ accum_pkt->addr = (char *) win_ptr->base_addrs[target_rank] +
+ win_ptr->disp_units[target_rank] * target_disp;
+ accum_pkt->count = target_count;
+ accum_pkt->datatype = target_datatype;
+ accum_pkt->dataloop_size = 0;
+ accum_pkt->op = op;
+ accum_pkt->target_win_handle = win_ptr->all_win_handles[target_rank];
+ accum_pkt->source_win_handle = win_ptr->handle;
+
+ new_ptr->origin_addr = (void *) origin_addr;
+ new_ptr->origin_count = origin_count;
+ new_ptr->origin_datatype = origin_datatype;
+ new_ptr->result_addr = result_addr;
+ new_ptr->result_count = result_count;
+ new_ptr->result_datatype = result_datatype;
+ new_ptr->target_rank = target_rank;
+ }
+
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
/* if source or target datatypes are derived, increment their
@@ -188,6 +214,8 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
MPIDI_RMA_Ops_list_t *ops_list = MPIDI_CH3I_RMA_Get_ops_list(win_ptr, target_rank);
MPIDI_RMA_Op_t *new_ptr = NULL;
+ MPIDI_CH3_Pkt_cas_t *cas_pkt = NULL;
+
/* Append this operation to the RMA ops queue */
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(ops_list, &new_ptr);
@@ -195,20 +223,23 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
- new_ptr->type = MPIDI_RMA_COMPARE_AND_SWAP;
+
+ cas_pkt = &(new_ptr->pkt.cas);
+ MPIDI_Pkt_init(cas_pkt, MPIDI_CH3_PKT_CAS);
+ cas_pkt->addr = (char *) win_ptr->base_addrs[target_rank] +
+ win_ptr->disp_units[target_rank] * target_disp;
+ cas_pkt->datatype = datatype;
+ cas_pkt->target_win_handle = win_ptr->all_win_handles[target_rank];
+ cas_pkt->source_win_handle = win_ptr->handle;
+
new_ptr->origin_addr = (void *) origin_addr;
new_ptr->origin_count = 1;
new_ptr->origin_datatype = datatype;
- new_ptr->target_rank = target_rank;
- new_ptr->target_disp = target_disp;
- new_ptr->target_count = 1;
- new_ptr->target_datatype = datatype;
new_ptr->result_addr = result_addr;
- new_ptr->result_count = 1;
new_ptr->result_datatype = datatype;
new_ptr->compare_addr = (void *) compare_addr;
- new_ptr->compare_count = 1;
new_ptr->compare_datatype = datatype;
+ new_ptr->target_rank = target_rank;
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
}
@@ -280,6 +311,8 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
MPIDI_RMA_Ops_list_t *ops_list = MPIDI_CH3I_RMA_Get_ops_list(win_ptr, target_rank);
MPIDI_RMA_Op_t *new_ptr = NULL;
+ MPIDI_CH3_Pkt_fop_t *fop_pkt = NULL;
+
/* Append this operation to the RMA ops queue */
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(ops_list, &new_ptr);
@@ -287,18 +320,21 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
- new_ptr->type = MPIDI_RMA_FETCH_AND_OP;
+ fop_pkt = &(new_ptr->pkt.fop);
+ MPIDI_Pkt_init(fop_pkt, MPIDI_CH3_PKT_FOP);
+ fop_pkt->addr = (char *) win_ptr->base_addrs[target_rank] +
+ win_ptr->disp_units[target_rank] * target_disp;
+ fop_pkt->datatype = datatype;
+ fop_pkt->op = op;
+ fop_pkt->source_win_handle = win_ptr->handle;
+ fop_pkt->target_win_handle = win_ptr->all_win_handles[target_rank];
+
new_ptr->origin_addr = (void *) origin_addr;
new_ptr->origin_count = 1;
new_ptr->origin_datatype = datatype;
- new_ptr->target_rank = target_rank;
- new_ptr->target_disp = target_disp;
- new_ptr->target_count = 1;
- new_ptr->target_datatype = datatype;
new_ptr->result_addr = result_addr;
- new_ptr->result_count = 1;
new_ptr->result_datatype = datatype;
- new_ptr->op = op;
+ new_ptr->target_rank = target_rank;
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
}
diff --git a/src/mpid/ch3/src/ch3u_rma_ops.c b/src/mpid/ch3/src/ch3u_rma_ops.c
index f30c464..a9d8224 100644
--- a/src/mpid/ch3/src/ch3u_rma_ops.c
+++ b/src/mpid/ch3/src/ch3u_rma_ops.c
@@ -173,6 +173,8 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
MPIDI_RMA_Ops_list_t *ops_list = MPIDI_CH3I_RMA_Get_ops_list(win_ptr, target_rank);
MPIDI_RMA_Op_t *new_ptr = NULL;
+ MPIDI_CH3_Pkt_put_t *put_pkt = NULL;
+
/* queue it up */
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(ops_list, &new_ptr);
@@ -180,18 +182,22 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
+
+ put_pkt = &(new_ptr->pkt.put);
+ MPIDI_Pkt_init(put_pkt, MPIDI_CH3_PKT_PUT);
+ put_pkt->addr = (char *) win_ptr->base_addrs[target_rank] +
+ win_ptr->disp_units[target_rank] * target_disp;
+ put_pkt->count = target_count;
+ put_pkt->datatype = target_datatype;
+ put_pkt->dataloop_size = 0;
+ put_pkt->target_win_handle = win_ptr->all_win_handles[target_rank];
+ put_pkt->source_win_handle = win_ptr->handle;
+
/* FIXME: For contig and very short operations, use a streamlined op */
- new_ptr->type = MPIDI_RMA_PUT;
- /* Cast away const'ness for the origin address, as the
- * MPIDI_RMA_Op_t structure is used for both PUT and GET like
- * operations */
new_ptr->origin_addr = (void *) origin_addr;
new_ptr->origin_count = origin_count;
new_ptr->origin_datatype = origin_datatype;
- new_ptr->target_rank = target_rank;
- new_ptr->target_disp = target_disp;
- new_ptr->target_count = target_count;
- new_ptr->target_datatype = target_datatype;
+ new_ptr->target_rank = target_rank;
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
/* if source or target datatypes are derived, increment their
@@ -285,6 +291,8 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
MPIDI_RMA_Ops_list_t *ops_list = MPIDI_CH3I_RMA_Get_ops_list(win_ptr, target_rank);
MPIDI_RMA_Op_t *new_ptr = NULL;
+ MPIDI_CH3_Pkt_get_t *get_pkt = NULL;
+
/* queue it up */
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(ops_list, &new_ptr);
@@ -292,15 +300,22 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
+
+ get_pkt = &(new_ptr->pkt.get);
+ MPIDI_Pkt_init(get_pkt, MPIDI_CH3_PKT_GET);
+ get_pkt->addr = (char *) win_ptr->base_addrs[target_rank] +
+ win_ptr->disp_units[target_rank] * target_disp;
+ get_pkt->count = target_count;
+ get_pkt->datatype = target_datatype;
+ get_pkt->dataloop_size = 0;
+ get_pkt->target_win_handle = win_ptr->all_win_handles[target_rank];
+ get_pkt->source_win_handle = win_ptr->handle;
+
/* FIXME: For contig and very short operations, use a streamlined op */
- new_ptr->type = MPIDI_RMA_GET;
new_ptr->origin_addr = origin_addr;
new_ptr->origin_count = origin_count;
new_ptr->origin_datatype = origin_datatype;
- new_ptr->target_rank = target_rank;
- new_ptr->target_disp = target_disp;
- new_ptr->target_count = target_count;
- new_ptr->target_datatype = target_datatype;
+ new_ptr->target_rank = target_rank;
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
/* if source or target datatypes are derived, increment their
@@ -396,6 +411,8 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
MPIDI_RMA_Ops_list_t *ops_list = MPIDI_CH3I_RMA_Get_ops_list(win_ptr, target_rank);
MPIDI_RMA_Op_t *new_ptr = NULL;
+ MPIDI_CH3_Pkt_accum_t *accum_pkt = NULL;
+
/* queue it up */
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(ops_list, &new_ptr);
@@ -405,35 +422,52 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
/* If predefined and contiguous, use a simplified element */
if (MPIR_DATATYPE_IS_PREDEFINED(origin_datatype) &&
MPIR_DATATYPE_IS_PREDEFINED(target_datatype) && enableShortACC) {
+ MPI_Aint origin_type_size;
+ size_t len;
+
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
- new_ptr->type = MPIDI_RMA_ACC_CONTIG;
- /* Only the information needed for the contig/predefined acc */
- /* Cast away const'ness for origin_address as
- * MPIDI_RMA_Op_t contain both PUT and GET like ops */
- new_ptr->origin_addr = (void *) origin_addr;
- new_ptr->origin_count = origin_count;
- new_ptr->origin_datatype = origin_datatype;
- new_ptr->target_rank = target_rank;
- new_ptr->target_disp = target_disp;
- new_ptr->target_count = target_count;
- new_ptr->target_datatype = target_datatype;
- new_ptr->op = op;
- MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
- goto fn_exit;
+
+ MPID_Datatype_get_size_macro(origin_datatype, origin_type_size);
+ MPIU_Assign_trunc(len, origin_count * origin_type_size, size_t);
+ if (MPIR_CVAR_CH3_RMA_ACC_IMMED && len <= MPIDI_RMA_IMMED_INTS*sizeof(int)) {
+ MPIDI_CH3_Pkt_accum_immed_t *accumi_pkt = &(new_ptr->pkt.accum_immed);
+
+ MPIDI_Pkt_init(accumi_pkt, MPIDI_CH3_PKT_ACCUM_IMMED);
+ accumi_pkt->addr = (char *) win_ptr->base_addrs[target_rank] +
+ win_ptr->disp_units[target_rank] * target_disp;
+ accumi_pkt->count = target_count;
+ accumi_pkt->datatype = target_datatype;
+ accumi_pkt->op = op;
+ accumi_pkt->target_win_handle = win_ptr->all_win_handles[target_rank];
+ accumi_pkt->source_win_handle = win_ptr->handle;
+
+ new_ptr->origin_addr = (void *) origin_addr;
+ new_ptr->origin_count = origin_count;
+ new_ptr->origin_datatype = origin_datatype;
+ new_ptr->target_rank = target_rank;
+ MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
+ goto fn_exit;
+ }
}
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
- new_ptr->type = MPIDI_RMA_ACCUMULATE;
- /* Cast away const'ness for origin_address as MPIDI_RMA_Op_t
- * contain both PUT and GET like ops */
+
+ accum_pkt = &(new_ptr->pkt.accum);
+
+ MPIDI_Pkt_init(accum_pkt, MPIDI_CH3_PKT_ACCUMULATE);
+ accum_pkt->addr = (char *) win_ptr->base_addrs[target_rank] +
+ win_ptr->disp_units[target_rank] * target_disp;
+ accum_pkt->count = target_count;
+ accum_pkt->datatype = target_datatype;
+ accum_pkt->dataloop_size = 0;
+ accum_pkt->op = op;
+ accum_pkt->target_win_handle = win_ptr->all_win_handles[target_rank];
+ accum_pkt->source_win_handle = win_ptr->handle;
+
new_ptr->origin_addr = (void *) origin_addr;
new_ptr->origin_count = origin_count;
new_ptr->origin_datatype = origin_datatype;
- new_ptr->target_rank = target_rank;
- new_ptr->target_disp = target_disp;
- new_ptr->target_count = target_count;
- new_ptr->target_datatype = target_datatype;
- new_ptr->op = op;
+ new_ptr->target_rank = target_rank;
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
/* if source or target datatypes are derived, increment their
diff --git a/src/mpid/ch3/src/ch3u_rma_sync.c b/src/mpid/ch3/src/ch3u_rma_sync.c
index 740192b..7fb9a42 100644
--- a/src/mpid/ch3/src/ch3u_rma_sync.c
+++ b/src/mpid/ch3/src/ch3u_rma_sync.c
@@ -1017,24 +1017,10 @@ static int send_unlock_msg(int dest, MPID_Win *win_ptr);
/* static int send_flush_msg(int dest, MPID_Win *win_ptr); */
static int wait_for_lock_granted(MPID_Win *win_ptr, int target_rank);
static int acquire_local_lock(MPID_Win *win_ptr, int lock_mode);
-static int send_rma_msg(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
- MPIDI_CH3_Pkt_flags_t flags,
- MPI_Win source_win_handle,
- MPI_Win target_win_handle,
- MPIDI_RMA_dtype_info * dtype_info,
- void ** dataloop, MPID_Request ** request);
-static int recv_rma_msg(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr,
- MPIDI_CH3_Pkt_flags_t flags,
- MPI_Win source_win_handle,
- MPI_Win target_win_handle,
- MPIDI_RMA_dtype_info * dtype_info,
- void ** dataloop, MPID_Request ** request);
-static int send_contig_acc_msg(MPIDI_RMA_Op_t *, MPID_Win *,
- MPIDI_CH3_Pkt_flags_t flags,
- MPI_Win, MPI_Win, MPID_Request ** );
-static int send_immed_rmw_msg(MPIDI_RMA_Op_t *, MPID_Win *,
- MPIDI_CH3_Pkt_flags_t flags,
- MPI_Win, MPI_Win, MPID_Request ** );
+static int send_rma_msg(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr, MPIDI_CH3_Pkt_flags_t flags);
+static int recv_rma_msg(MPIDI_RMA_Op_t * rma_op, MPID_Win * win_ptr, MPIDI_CH3_Pkt_flags_t flags);
+static int send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr, MPIDI_CH3_Pkt_flags_t flags);
+static int send_immed_rmw_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr, MPIDI_CH3_Pkt_flags_t flags);
static int do_passive_target_rma(MPID_Win *win_ptr, int target_rank,
int *wait_for_rma_done_pkt,
MPIDI_CH3_Pkt_flags_t sync_flags);
@@ -1056,60 +1042,30 @@ static int create_datatype(const MPIDI_RMA_dtype_info *dtype_info,
/* Issue an RMA operation -- Before calling this macro, you must define the
* MPIDI_CH3I_TRACK_RMA_WRITE helper macro. This macro defines any extra action
* that should be taken when a write (put/acc) operation is encountered. */
-#define MPIDI_CH3I_ISSUE_RMA_OP(op_ptr_, win_ptr_, flags_, source_win_handle_, target_win_handle_,err_) \
+#define MPIDI_CH3I_ISSUE_RMA_OP(op_ptr_, win_ptr_, flags_, err_) \
do { \
- switch ((op_ptr_)->type) \
+ switch ((op_ptr_)->pkt.type) \
{ \
- case (MPIDI_RMA_PUT): \
- case (MPIDI_RMA_ACCUMULATE): \
+ case (MPIDI_CH3_PKT_PUT): \
+ case (MPIDI_CH3_PKT_ACCUMULATE): \
+ case (MPIDI_CH3_PKT_GET_ACCUM): \
MPIDI_CH3I_TRACK_RMA_WRITE(op_ptr_, win_ptr_); \
- (err_) = send_rma_msg((op_ptr_), (win_ptr_), (flags_), (source_win_handle_), \
- (target_win_handle_), &(op_ptr_)->dtype_info, \
- &(op_ptr_)->dataloop, &(op_ptr_)->request); \
+ (err_) = send_rma_msg((op_ptr_), (win_ptr_), (flags_)); \
if (err_) { MPIU_ERR_POP(err_); } \
break; \
- case (MPIDI_RMA_GET_ACCUMULATE): \
- if ((op_ptr_)->op == MPI_NO_OP) { \
- /* Note: Origin arguments are ignored for NO_OP, so we don't \
- * need to release a ref to the origin datatype. */ \
- \
- /* Convert the GAcc to a Get */ \
- (op_ptr_)->type = MPIDI_RMA_GET; \
- (op_ptr_)->origin_addr = (op_ptr_)->result_addr; \
- (op_ptr_)->origin_count = (op_ptr_)->result_count; \
- (op_ptr_)->origin_datatype = (op_ptr_)->result_datatype; \
- \
- (err_) = recv_rma_msg((op_ptr_), (win_ptr_), (flags_), (source_win_handle_), \
- (target_win_handle_), &(op_ptr_)->dtype_info,\
- &(op_ptr_)->dataloop, &(op_ptr_)->request); \
- } else { \
- MPIDI_CH3I_TRACK_RMA_WRITE(op_ptr_, win_ptr_); \
- (err_) = send_rma_msg((op_ptr_), (win_ptr_), (flags_), (source_win_handle_), \
- (target_win_handle_), &(op_ptr_)->dtype_info,\
- &(op_ptr_)->dataloop, &(op_ptr_)->request); \
- } \
- if (err_) { MPIU_ERR_POP(err_); } \
- break; \
- case MPIDI_RMA_ACC_CONTIG: \
+ case MPIDI_CH3_PKT_ACCUM_IMMED: \
MPIDI_CH3I_TRACK_RMA_WRITE(op_ptr_, win_ptr_); \
- (err_) = send_contig_acc_msg((op_ptr_), (win_ptr_), (flags_), \
- (source_win_handle_), (target_win_handle_),\
- &(op_ptr_)->request ); \
+ (err_) = send_contig_acc_msg((op_ptr_), (win_ptr_), (flags_)); \
if (err_) { MPIU_ERR_POP(err_); } \
break; \
- case (MPIDI_RMA_GET): \
- (err_) = recv_rma_msg((op_ptr_), (win_ptr_), (flags_), \
- (source_win_handle_), (target_win_handle_), \
- &(op_ptr_)->dtype_info, \
- &(op_ptr_)->dataloop, &(op_ptr_)->request); \
+ case (MPIDI_CH3_PKT_GET): \
+ (err_) = recv_rma_msg((op_ptr_), (win_ptr_), (flags_)); \
if (err_) { MPIU_ERR_POP(err_); } \
break; \
- case (MPIDI_RMA_COMPARE_AND_SWAP): \
- case (MPIDI_RMA_FETCH_AND_OP): \
+ case (MPIDI_CH3_PKT_CAS): \
+ case (MPIDI_CH3_PKT_FOP): \
MPIDI_CH3I_TRACK_RMA_WRITE(op_ptr_, win_ptr_); \
- (err_) = send_immed_rmw_msg((op_ptr_), (win_ptr_), (flags_), \
- (source_win_handle_), (target_win_handle_),\
- &(op_ptr_)->request ); \
+ (err_) = send_immed_rmw_msg((op_ptr_), (win_ptr_), (flags_)); \
if (err_) { MPIU_ERR_POP(err_); } \
break; \
\
@@ -1131,7 +1087,6 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr)
MPIDI_RMA_Op_t *curr_ptr;
MPIDI_RMA_Ops_list_t *ops_list;
MPID_Comm *comm_ptr;
- MPI_Win source_win_handle, target_win_handle;
MPID_Progress_state progress_state;
int errflag = FALSE;
MPIU_CHKLMEM_DECL(3);
@@ -1310,12 +1265,8 @@ int MPIDI_Win_fence(int assert, MPID_Win *win_ptr)
flags = MPIDI_CH3_PKT_FLAG_RMA_AT_COMPLETE;
}
- source_win_handle = win_ptr->handle;
- target_win_handle = win_ptr->all_win_handles[curr_ptr->target_rank];
-
#define MPIDI_CH3I_TRACK_RMA_WRITE(op_ptr_, win_ptr_) /* Not used by active mode */
- MPIDI_CH3I_ISSUE_RMA_OP(curr_ptr, win_ptr, flags,
- source_win_handle, target_win_handle, mpi_errno);
+ MPIDI_CH3I_ISSUE_RMA_OP(curr_ptr, win_ptr, flags, mpi_errno);
#undef MPIDI_CH3I_TRACK_RMA_WRITE
i++;
@@ -1497,16 +1448,10 @@ static int create_datatype(const MPIDI_RMA_dtype_info *dtype_info,
#define FUNCNAME send_rma_msg
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
-static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
- MPIDI_CH3_Pkt_flags_t flags,
- MPI_Win source_win_handle,
- MPI_Win target_win_handle,
- MPIDI_RMA_dtype_info *dtype_info,
- void **dataloop, MPID_Request **request)
+static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
- MPIDI_CH3_Pkt_t upkt;
- MPIDI_CH3_Pkt_put_t *put_pkt = &upkt.put;
- MPIDI_CH3_Pkt_accum_t *accum_pkt = &upkt.accum;
+ MPIDI_CH3_Pkt_put_t *put_pkt = &rma_op->pkt.put;
+ MPIDI_CH3_Pkt_accum_t *accum_pkt = &rma_op->pkt.accum;
MPID_IOV iov[MPID_IOV_LIMIT];
int mpi_errno=MPI_SUCCESS;
int origin_dt_derived, target_dt_derived, iovcnt;
@@ -1514,6 +1459,7 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
MPIDI_VC_t * vc;
MPID_Comm *comm_ptr;
MPID_Datatype *target_dtp=NULL, *origin_dtp=NULL;
+ MPI_Datatype target_datatype;
MPID_Request *resp_req=NULL;
MPIU_CHKPMEM_DECL(1);
MPIDI_STATE_DECL(MPID_STATE_SEND_RMA_MSG);
@@ -1521,24 +1467,15 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
MPIDI_RMA_FUNC_ENTER(MPID_STATE_SEND_RMA_MSG);
- *request = NULL;
+ rma_op->request = NULL;
- if (rma_op->type == MPIDI_RMA_PUT)
+ if (rma_op->pkt.type == MPIDI_CH3_PKT_PUT)
{
- MPIDI_Pkt_init(put_pkt, MPIDI_CH3_PKT_PUT);
- put_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
put_pkt->flags = flags;
- put_pkt->count = rma_op->target_count;
- put_pkt->datatype = rma_op->target_datatype;
- put_pkt->dataloop_size = 0;
- put_pkt->target_win_handle = target_win_handle;
- put_pkt->source_win_handle = source_win_handle;
-
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) put_pkt;
iov[0].MPID_IOV_LEN = sizeof(*put_pkt);
}
- else if (rma_op->type == MPIDI_RMA_GET_ACCUMULATE)
+ else if (rma_op->pkt.type == MPIDI_CH3_PKT_GET_ACCUM)
{
/* Create a request for the GACC response. Store the response buf, count, and
datatype in it, and pass the request's handle in the GACC packet. When the
@@ -1551,8 +1488,8 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
resp_req->dev.user_buf = rma_op->result_addr;
resp_req->dev.user_count = rma_op->result_count;
resp_req->dev.datatype = rma_op->result_datatype;
- resp_req->dev.target_win_handle = target_win_handle;
- resp_req->dev.source_win_handle = source_win_handle;
+ resp_req->dev.target_win_handle = accum_pkt->target_win_handle;
+ resp_req->dev.source_win_handle = accum_pkt->source_win_handle;
if (!MPIR_DATATYPE_IS_PREDEFINED(resp_req->dev.datatype)) {
MPID_Datatype *result_dtp = NULL;
@@ -1563,34 +1500,14 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
}
/* Note: Get_accumulate uses the same packet type as accumulate */
- MPIDI_Pkt_init(accum_pkt, MPIDI_CH3_PKT_GET_ACCUM);
- accum_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
- accum_pkt->flags = flags;
- accum_pkt->count = rma_op->target_count;
- accum_pkt->datatype = rma_op->target_datatype;
- accum_pkt->dataloop_size = 0;
- accum_pkt->op = rma_op->op;
- accum_pkt->target_win_handle = target_win_handle;
- accum_pkt->source_win_handle = source_win_handle;
accum_pkt->request_handle = resp_req->handle;
-
+ accum_pkt->flags = flags;
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) accum_pkt;
iov[0].MPID_IOV_LEN = sizeof(*accum_pkt);
}
else
{
- MPIDI_Pkt_init(accum_pkt, MPIDI_CH3_PKT_ACCUMULATE);
- accum_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
accum_pkt->flags = flags;
- accum_pkt->count = rma_op->target_count;
- accum_pkt->datatype = rma_op->target_datatype;
- accum_pkt->dataloop_size = 0;
- accum_pkt->op = rma_op->op;
- accum_pkt->target_win_handle = target_win_handle;
- accum_pkt->source_win_handle = source_win_handle;
-
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) accum_pkt;
iov[0].MPID_IOV_LEN = sizeof(*accum_pkt);
}
@@ -1613,10 +1530,11 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
origin_dt_derived = 0;
}
- if (!MPIR_DATATYPE_IS_PREDEFINED(rma_op->target_datatype))
+ MPIDI_CH3_PKT_RMA_GET_TARGET_DATATYPE(rma_op->pkt, target_datatype);
+ if (!MPIR_DATATYPE_IS_PREDEFINED(target_datatype))
{
target_dt_derived = 1;
- MPID_Datatype_get_ptr(rma_op->target_datatype, target_dtp);
+ MPID_Datatype_get_ptr(target_datatype, target_dtp);
}
else
{
@@ -1626,32 +1544,32 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
if (target_dt_derived)
{
/* derived datatype on target. fill derived datatype info */
- dtype_info->is_contig = target_dtp->is_contig;
- dtype_info->max_contig_blocks = target_dtp->max_contig_blocks;
- dtype_info->size = target_dtp->size;
- dtype_info->extent = target_dtp->extent;
- dtype_info->dataloop_size = target_dtp->dataloop_size;
- dtype_info->dataloop_depth = target_dtp->dataloop_depth;
- dtype_info->eltype = target_dtp->eltype;
- dtype_info->dataloop = target_dtp->dataloop;
- dtype_info->ub = target_dtp->ub;
- dtype_info->lb = target_dtp->lb;
- dtype_info->true_ub = target_dtp->true_ub;
- dtype_info->true_lb = target_dtp->true_lb;
- dtype_info->has_sticky_ub = target_dtp->has_sticky_ub;
- dtype_info->has_sticky_lb = target_dtp->has_sticky_lb;
-
- MPIU_CHKPMEM_MALLOC(*dataloop, void *, target_dtp->dataloop_size,
+ rma_op->dtype_info.is_contig = target_dtp->is_contig;
+ rma_op->dtype_info.max_contig_blocks = target_dtp->max_contig_blocks;
+ rma_op->dtype_info.size = target_dtp->size;
+ rma_op->dtype_info.extent = target_dtp->extent;
+ rma_op->dtype_info.dataloop_size = target_dtp->dataloop_size;
+ rma_op->dtype_info.dataloop_depth = target_dtp->dataloop_depth;
+ rma_op->dtype_info.eltype = target_dtp->eltype;
+ rma_op->dtype_info.dataloop = target_dtp->dataloop;
+ rma_op->dtype_info.ub = target_dtp->ub;
+ rma_op->dtype_info.lb = target_dtp->lb;
+ rma_op->dtype_info.true_ub = target_dtp->true_ub;
+ rma_op->dtype_info.true_lb = target_dtp->true_lb;
+ rma_op->dtype_info.has_sticky_ub = target_dtp->has_sticky_ub;
+ rma_op->dtype_info.has_sticky_lb = target_dtp->has_sticky_lb;
+
+ MPIU_CHKPMEM_MALLOC(rma_op->dataloop, void *, target_dtp->dataloop_size,
mpi_errno, "dataloop");
MPIDI_FUNC_ENTER(MPID_STATE_MEMCPY);
- MPIU_Memcpy(*dataloop, target_dtp->dataloop, target_dtp->dataloop_size);
+ MPIU_Memcpy(rma_op->dataloop, target_dtp->dataloop, target_dtp->dataloop_size);
MPIDI_FUNC_EXIT(MPID_STATE_MEMCPY);
/* the dataloop can have undefined padding sections, so we need to let
* valgrind know that it is OK to pass this data to writev later on */
- MPL_VG_MAKE_MEM_DEFINED(*dataloop, target_dtp->dataloop_size);
+ MPL_VG_MAKE_MEM_DEFINED(rma_op->dataloop, target_dtp->dataloop_size);
- if (rma_op->type == MPIDI_RMA_PUT)
+ if (rma_op->pkt.type == MPIDI_CH3_PKT_PUT)
{
put_pkt->dataloop_size = target_dtp->dataloop_size;
}
@@ -1673,36 +1591,36 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
iov[1].MPID_IOV_LEN = rma_op->origin_count * origin_type_size;
iovcnt = 2;
MPIU_THREAD_CS_ENTER(CH3COMM,vc);
- mpi_errno = MPIDI_CH3_iStartMsgv(vc, iov, iovcnt, request);
+ mpi_errno = MPIDI_CH3_iStartMsgv(vc, iov, iovcnt, &rma_op->request);
MPIU_THREAD_CS_EXIT(CH3COMM,vc);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
}
else
{
/* derived datatype on origin */
- *request = MPID_Request_create();
- MPIU_ERR_CHKANDJUMP(*request == NULL,mpi_errno,MPI_ERR_OTHER,"**nomemreq");
+ rma_op->request = MPID_Request_create();
+ MPIU_ERR_CHKANDJUMP(rma_op->request == NULL,mpi_errno,MPI_ERR_OTHER,"**nomemreq");
- MPIU_Object_set_ref(*request, 2);
- (*request)->kind = MPID_REQUEST_SEND;
+ MPIU_Object_set_ref(rma_op->request, 2);
+ rma_op->request->kind = MPID_REQUEST_SEND;
- (*request)->dev.segment_ptr = MPID_Segment_alloc( );
- MPIU_ERR_CHKANDJUMP1((*request)->dev.segment_ptr == NULL, mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
+ rma_op->request->dev.segment_ptr = MPID_Segment_alloc( );
+ MPIU_ERR_CHKANDJUMP1(rma_op->request->dev.segment_ptr == NULL, mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
- (*request)->dev.datatype_ptr = origin_dtp;
+ rma_op->request->dev.datatype_ptr = origin_dtp;
/* this will cause the datatype to be freed when the request
is freed. */
MPID_Segment_init(rma_op->origin_addr, rma_op->origin_count,
rma_op->origin_datatype,
- (*request)->dev.segment_ptr, 0);
- (*request)->dev.segment_first = 0;
- (*request)->dev.segment_size = rma_op->origin_count * origin_type_size;
+ rma_op->request->dev.segment_ptr, 0);
+ rma_op->request->dev.segment_first = 0;
+ rma_op->request->dev.segment_size = rma_op->origin_count * origin_type_size;
- (*request)->dev.OnFinal = 0;
- (*request)->dev.OnDataAvail = 0;
+ rma_op->request->dev.OnFinal = 0;
+ rma_op->request->dev.OnDataAvail = 0;
MPIU_THREAD_CS_ENTER(CH3COMM,vc);
- mpi_errno = vc->sendNoncontig_fn(vc, *request, iov[0].MPID_IOV_BUF, iov[0].MPID_IOV_LEN);
+ mpi_errno = vc->sendNoncontig_fn(vc, rma_op->request, iov[0].MPID_IOV_BUF, iov[0].MPID_IOV_LEN);
MPIU_THREAD_CS_EXIT(CH3COMM,vc);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
}
@@ -1712,36 +1630,36 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
/* derived datatype on target */
MPID_Datatype *combined_dtp = NULL;
- *request = MPID_Request_create();
- if (*request == NULL) {
+ rma_op->request = MPID_Request_create();
+ if (rma_op->request == NULL) {
MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomemreq");
}
- MPIU_Object_set_ref(*request, 2);
- (*request)->kind = MPID_REQUEST_SEND;
+ MPIU_Object_set_ref(rma_op->request, 2);
+ rma_op->request->kind = MPID_REQUEST_SEND;
- (*request)->dev.segment_ptr = MPID_Segment_alloc( );
- MPIU_ERR_CHKANDJUMP1((*request)->dev.segment_ptr == NULL, mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
+ rma_op->request->dev.segment_ptr = MPID_Segment_alloc( );
+ MPIU_ERR_CHKANDJUMP1(rma_op->request->dev.segment_ptr == NULL, mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
/* create a new datatype containing the dtype_info, dataloop, and origin data */
- mpi_errno = create_datatype(dtype_info, *dataloop, target_dtp->dataloop_size, rma_op->origin_addr,
+ mpi_errno = create_datatype(&rma_op->dtype_info, rma_op->dataloop, target_dtp->dataloop_size, rma_op->origin_addr,
rma_op->origin_count, rma_op->origin_datatype, &combined_dtp);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
- (*request)->dev.datatype_ptr = combined_dtp;
+ rma_op->request->dev.datatype_ptr = combined_dtp;
/* combined_datatype will be freed when request is freed */
MPID_Segment_init(MPI_BOTTOM, 1, combined_dtp->handle,
- (*request)->dev.segment_ptr, 0);
- (*request)->dev.segment_first = 0;
- (*request)->dev.segment_size = combined_dtp->size;
+ rma_op->request->dev.segment_ptr, 0);
+ rma_op->request->dev.segment_first = 0;
+ rma_op->request->dev.segment_size = combined_dtp->size;
- (*request)->dev.OnFinal = 0;
- (*request)->dev.OnDataAvail = 0;
+ rma_op->request->dev.OnFinal = 0;
+ rma_op->request->dev.OnDataAvail = 0;
MPIU_THREAD_CS_ENTER(CH3COMM,vc);
- mpi_errno = vc->sendNoncontig_fn(vc, *request, iov[0].MPID_IOV_BUF, iov[0].MPID_IOV_LEN);
+ mpi_errno = vc->sendNoncontig_fn(vc, rma_op->request, iov[0].MPID_IOV_BUF, iov[0].MPID_IOV_LEN);
MPIU_THREAD_CS_EXIT(CH3COMM,vc);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
@@ -1754,7 +1672,7 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
/* This operation can generate two requests; one for inbound and one for
outbound data. */
if (resp_req != NULL) {
- if (*request != NULL) {
+ if (rma_op->request != NULL) {
/* If we have both inbound and outbound requests (i.e. GACC
operation), we need to ensure that the source buffer is
available and that the response data has been received before
@@ -1770,11 +1688,11 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
it will be completed by the progress engine.
*/
- MPID_Request_release(*request);
- *request = resp_req;
+ MPID_Request_release(rma_op->request);
+ rma_op->request = resp_req;
} else {
- *request = resp_req;
+ rma_op->request = resp_req;
}
/* For error checking */
@@ -1790,14 +1708,14 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
if (resp_req) {
MPID_Request_release(resp_req);
}
- if (*request)
+ if (rma_op->request)
{
MPIU_CHKPMEM_REAP();
- if ((*request)->dev.datatype_ptr)
- MPID_Datatype_release((*request)->dev.datatype_ptr);
- MPID_Request_release(*request);
+ if (rma_op->request->dev.datatype_ptr)
+ MPID_Datatype_release(rma_op->request->dev.datatype_ptr);
+ MPID_Request_release(rma_op->request);
}
- *request = NULL;
+ rma_op->request = NULL;
goto fn_exit;
/* --END ERROR HANDLING-- */
}
@@ -1809,15 +1727,9 @@ static int send_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
#define FUNCNAME send_contig_acc_msg
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
-static int send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op,
- MPID_Win *win_ptr,
- MPIDI_CH3_Pkt_flags_t flags,
- MPI_Win source_win_handle,
- MPI_Win target_win_handle,
- MPID_Request **request)
+static int send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
- MPIDI_CH3_Pkt_t upkt;
- MPIDI_CH3_Pkt_accum_t *accum_pkt = &upkt.accum;
+ MPIDI_CH3_Pkt_accum_t *accum_pkt = &rma_op->pkt.accum;
MPID_IOV iov[MPID_IOV_LIMIT];
int mpi_errno=MPI_SUCCESS;
int iovcnt;
@@ -1829,24 +1741,16 @@ static int send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op,
MPIDI_RMA_FUNC_ENTER(MPID_STATE_SEND_CONTIG_ACC_MSG);
- *request = NULL;
+ rma_op->request = NULL;
MPID_Datatype_get_size_macro(rma_op->origin_datatype, origin_type_size);
/* FIXME: Make this size check efficient and match the packet type */
MPIU_Assign_trunc(len, rma_op->origin_count * origin_type_size, size_t);
if (MPIR_CVAR_CH3_RMA_ACC_IMMED && len <= MPIDI_RMA_IMMED_INTS*sizeof(int)) {
- MPIDI_CH3_Pkt_accum_immed_t * accumi_pkt = &upkt.accum_immed;
+ MPIDI_CH3_Pkt_accum_immed_t * accumi_pkt = &rma_op->pkt.accum_immed;
void *dest = accumi_pkt->data, *src = rma_op->origin_addr;
- MPIDI_Pkt_init(accumi_pkt, MPIDI_CH3_PKT_ACCUM_IMMED);
- accumi_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
accumi_pkt->flags = flags;
- accumi_pkt->count = rma_op->target_count;
- accumi_pkt->datatype = rma_op->target_datatype;
- accumi_pkt->op = rma_op->op;
- accumi_pkt->target_win_handle = target_win_handle;
- accumi_pkt->source_win_handle = source_win_handle;
switch (len) {
case 1: *(uint8_t *)dest = *(uint8_t *)src; break;
@@ -1859,23 +1763,13 @@ static int send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op,
comm_ptr = win_ptr->comm_ptr;
MPIDI_Comm_get_vc_set_active(comm_ptr, rma_op->target_rank, &vc);
MPIU_THREAD_CS_ENTER(CH3COMM,vc);
- mpi_errno = MPIDI_CH3_iStartMsg(vc, accumi_pkt, sizeof(*accumi_pkt), request);
+ mpi_errno = MPIDI_CH3_iStartMsg(vc, accumi_pkt, sizeof(*accumi_pkt), &rma_op->request);
MPIU_THREAD_CS_EXIT(CH3COMM,vc);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
goto fn_exit;
}
- MPIDI_Pkt_init(accum_pkt, MPIDI_CH3_PKT_ACCUMULATE);
- accum_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
accum_pkt->flags = flags;
- accum_pkt->count = rma_op->target_count;
- accum_pkt->datatype = rma_op->target_datatype;
- accum_pkt->dataloop_size = 0;
- accum_pkt->op = rma_op->op;
- accum_pkt->target_win_handle = target_win_handle;
- accum_pkt->source_win_handle = source_win_handle;
-
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) accum_pkt;
iov[0].MPID_IOV_LEN = sizeof(*accum_pkt);
@@ -1898,7 +1792,7 @@ static int send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op,
iov[1].MPID_IOV_LEN = rma_op->origin_count * origin_type_size;
iovcnt = 2;
MPIU_THREAD_CS_ENTER(CH3COMM,vc);
- mpi_errno = MPIDI_CH3_iStartMsgv(vc, iov, iovcnt, request);
+ mpi_errno = MPIDI_CH3_iStartMsgv(vc, iov, iovcnt, &rma_op->request);
MPIU_THREAD_CS_EXIT(CH3COMM,vc);
MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
@@ -1907,11 +1801,11 @@ static int send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op,
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
fn_fail:
- if (*request)
+ if (rma_op->request)
{
- MPID_Request_release(*request);
+ MPID_Request_release(rma_op->request);
}
- *request = NULL;
+ rma_op->request = NULL;
goto fn_exit;
/* --END ERROR HANDLING-- */
}
@@ -1924,15 +1818,10 @@ static int send_contig_acc_msg(MPIDI_RMA_Op_t *rma_op,
#define FUNCNAME send_immed_rmw_msg
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
-static int send_immed_rmw_msg(MPIDI_RMA_Op_t *rma_op,
- MPID_Win *win_ptr,
- MPIDI_CH3_Pkt_flags_t flags,
- MPI_Win source_win_handle,
- MPI_Win target_win_handle,
- MPID_Request **request)
+static int send_immed_rmw_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
int mpi_errno = MPI_SUCCESS;
- MPID_Request *rmw_req = NULL, *resp_req = NULL;
+ MPID_Request *rmw_req = NULL;
MPIDI_VC_t *vc;
MPID_Comm *comm_ptr;
MPI_Aint len;
@@ -1940,45 +1829,37 @@ static int send_immed_rmw_msg(MPIDI_RMA_Op_t *rma_op,
MPIDI_RMA_FUNC_ENTER(MPID_STATE_SEND_IMMED_RMW_MSG);
- *request = NULL;
+ rma_op->request = NULL;
/* Create a request for the RMW response. Store the origin buf, count, and
datatype in it, and pass the request's handle RMW packet. When the
response comes from the target, it will contain the request handle. */
- resp_req = MPID_Request_create();
- MPIU_ERR_CHKANDJUMP(resp_req == NULL, mpi_errno, MPI_ERR_OTHER, "**nomemreq");
- *request = resp_req;
+ rma_op->request = MPID_Request_create();
+ MPIU_ERR_CHKANDJUMP(rma_op->request == NULL, mpi_errno, MPI_ERR_OTHER, "**nomemreq");
/* Set refs on the request to 2: one for the response message, and one for
the partial completion handler */
- MPIU_Object_set_ref(resp_req, 2);
+ MPIU_Object_set_ref(rma_op->request, 2);
- resp_req->dev.user_buf = rma_op->result_addr;
- resp_req->dev.user_count = rma_op->result_count;
- resp_req->dev.datatype = rma_op->result_datatype;
- resp_req->dev.target_win_handle = target_win_handle;
- resp_req->dev.source_win_handle = source_win_handle;
+ rma_op->request->dev.user_buf = rma_op->result_addr;
+ rma_op->request->dev.user_count = rma_op->result_count;
+ rma_op->request->dev.datatype = rma_op->result_datatype;
/* REQUIRE: All datatype arguments must be of the same, builtin
type and counts must be 1. */
MPID_Datatype_get_size_macro(rma_op->origin_datatype, len);
comm_ptr = win_ptr->comm_ptr;
- if (rma_op->type == MPIDI_RMA_COMPARE_AND_SWAP) {
- MPIDI_CH3_Pkt_t upkt;
- MPIDI_CH3_Pkt_cas_t *cas_pkt = &upkt.cas;
+ if (rma_op->pkt.type == MPIDI_CH3_PKT_CAS) {
+ MPIDI_CH3_Pkt_cas_t *cas_pkt = &rma_op->pkt.cas;
MPIU_Assert(len <= sizeof(MPIDI_CH3_CAS_Immed_u));
- MPIDI_Pkt_init(cas_pkt, MPIDI_CH3_PKT_CAS);
+ rma_op->request->dev.target_win_handle = cas_pkt->target_win_handle;
+ rma_op->request->dev.source_win_handle = cas_pkt->source_win_handle;
- cas_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
+ cas_pkt->request_handle = rma_op->request->handle;
cas_pkt->flags = flags;
- cas_pkt->datatype = rma_op->target_datatype;
- cas_pkt->target_win_handle = target_win_handle;
- cas_pkt->request_handle = resp_req->handle;
-
MPIU_Memcpy( (void *) &cas_pkt->origin_data, rma_op->origin_addr, len );
MPIU_Memcpy( (void *) &cas_pkt->compare_data, rma_op->compare_addr, len );
@@ -1993,25 +1874,20 @@ static int send_immed_rmw_msg(MPIDI_RMA_Op_t *rma_op,
}
}
- else if (rma_op->type == MPIDI_RMA_FETCH_AND_OP) {
- MPIDI_CH3_Pkt_t upkt;
- MPIDI_CH3_Pkt_fop_t *fop_pkt = &upkt.fop;
+ else if (rma_op->pkt.type == MPIDI_CH3_PKT_FOP) {
+ MPIDI_CH3_Pkt_fop_t *fop_pkt = &rma_op->pkt.fop;
MPIU_Assert(len <= sizeof(MPIDI_CH3_FOP_Immed_u));
- MPIDI_Pkt_init(fop_pkt, MPIDI_CH3_PKT_FOP);
+ rma_op->request->dev.target_win_handle = fop_pkt->target_win_handle;
+ rma_op->request->dev.source_win_handle = fop_pkt->source_win_handle;
- fop_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
+ fop_pkt->request_handle = rma_op->request->handle;
fop_pkt->flags = flags;
- fop_pkt->datatype = rma_op->target_datatype;
- fop_pkt->target_win_handle = target_win_handle;
- fop_pkt->request_handle = resp_req->handle;
- fop_pkt->op = rma_op->op;
- if (len <= sizeof(fop_pkt->origin_data) || rma_op->op == MPI_NO_OP) {
+ if (len <= sizeof(fop_pkt->origin_data) || fop_pkt->op == MPI_NO_OP) {
/* Embed FOP data in the packet header */
- if (rma_op->op != MPI_NO_OP) {
+ if (fop_pkt->op != MPI_NO_OP) {
MPIU_Memcpy( fop_pkt->origin_data, rma_op->origin_addr, len );
}
@@ -2058,10 +1934,10 @@ fn_exit:
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
fn_fail:
- if (*request) {
- MPID_Request_release(*request);
+ if (rma_op->request) {
+ MPID_Request_release(rma_op->request);
}
- *request = NULL;
+ rma_op->request = NULL;
if (rmw_req) {
MPID_Request_release(rmw_req);
}
@@ -2075,20 +1951,15 @@ fn_fail:
#define FUNCNAME recv_rma_msg
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
-static int recv_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
- MPIDI_CH3_Pkt_flags_t flags,
- MPI_Win source_win_handle,
- MPI_Win target_win_handle,
- MPIDI_RMA_dtype_info *dtype_info,
- void **dataloop, MPID_Request **request)
+static int recv_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr, MPIDI_CH3_Pkt_flags_t flags)
{
- MPIDI_CH3_Pkt_t upkt;
- MPIDI_CH3_Pkt_get_t *get_pkt = &upkt.get;
+ MPIDI_CH3_Pkt_get_t *get_pkt = &rma_op->pkt.get;
int mpi_errno=MPI_SUCCESS;
MPIDI_VC_t * vc;
MPID_Comm *comm_ptr;
- MPID_Request *req = NULL;
MPID_Datatype *dtp;
+ MPI_Datatype target_datatype;
+ MPID_Request *req = NULL;
MPID_IOV iov[MPID_IOV_LIMIT];
MPIU_CHKPMEM_DECL(1);
MPIDI_STATE_DECL(MPID_STATE_RECV_RMA_MSG);
@@ -2100,37 +1971,28 @@ static int recv_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
and pass a handle to it in the get packet. When the get
response comes from the target, it will contain the request
handle. */
- req = MPID_Request_create();
- if (req == NULL) {
+ rma_op->request = MPID_Request_create();
+ if (rma_op->request == NULL) {
MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomemreq");
}
- *request = req;
+ MPIU_Object_set_ref(rma_op->request, 2);
- MPIU_Object_set_ref(req, 2);
-
- req->dev.user_buf = rma_op->origin_addr;
- req->dev.user_count = rma_op->origin_count;
- req->dev.datatype = rma_op->origin_datatype;
- req->dev.target_win_handle = MPI_WIN_NULL;
- req->dev.source_win_handle = source_win_handle;
- if (!MPIR_DATATYPE_IS_PREDEFINED(req->dev.datatype))
+ rma_op->request->dev.user_buf = rma_op->origin_addr;
+ rma_op->request->dev.user_count = rma_op->origin_count;
+ rma_op->request->dev.datatype = rma_op->origin_datatype;
+ rma_op->request->dev.target_win_handle = MPI_WIN_NULL;
+ rma_op->request->dev.source_win_handle = get_pkt->source_win_handle;
+ if (!MPIR_DATATYPE_IS_PREDEFINED(rma_op->request->dev.datatype))
{
- MPID_Datatype_get_ptr(req->dev.datatype, dtp);
- req->dev.datatype_ptr = dtp;
+ MPID_Datatype_get_ptr(rma_op->request->dev.datatype, dtp);
+ rma_op->request->dev.datatype_ptr = dtp;
/* this will cause the datatype to be freed when the
request is freed. */
}
- MPIDI_Pkt_init(get_pkt, MPIDI_CH3_PKT_GET);
- get_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
+ get_pkt->request_handle = rma_op->request->handle;
get_pkt->flags = flags;
- get_pkt->count = rma_op->target_count;
- get_pkt->datatype = rma_op->target_datatype;
- get_pkt->request_handle = req->handle;
- get_pkt->target_win_handle = target_win_handle;
- get_pkt->source_win_handle = source_win_handle;
/* printf("send pkt: type %d, addr %d, count %d, base %d\n", rma_pkt->type,
rma_pkt->addr, rma_pkt->count, win_ptr->base_addrs[rma_op->target_rank]);
@@ -2140,7 +2002,8 @@ static int recv_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
comm_ptr = win_ptr->comm_ptr;
MPIDI_Comm_get_vc_set_active(comm_ptr, rma_op->target_rank, &vc);
- if (MPIR_DATATYPE_IS_PREDEFINED(rma_op->target_datatype))
+ MPIDI_CH3_PKT_RMA_GET_TARGET_DATATYPE(rma_op->pkt, target_datatype);
+ if (MPIR_DATATYPE_IS_PREDEFINED(target_datatype))
{
/* basic datatype on target. simply send the get_pkt. */
MPIU_THREAD_CS_ENTER(CH3COMM,vc);
@@ -2152,40 +2015,40 @@ static int recv_rma_msg(MPIDI_RMA_Op_t *rma_op, MPID_Win *win_ptr,
/* derived datatype on target. fill derived datatype info and
send it along with get_pkt. */
- MPID_Datatype_get_ptr(rma_op->target_datatype, dtp);
- dtype_info->is_contig = dtp->is_contig;
- dtype_info->max_contig_blocks = dtp->max_contig_blocks;
- dtype_info->size = dtp->size;
- dtype_info->extent = dtp->extent;
- dtype_info->dataloop_size = dtp->dataloop_size;
- dtype_info->dataloop_depth = dtp->dataloop_depth;
- dtype_info->eltype = dtp->eltype;
- dtype_info->dataloop = dtp->dataloop;
- dtype_info->ub = dtp->ub;
- dtype_info->lb = dtp->lb;
- dtype_info->true_ub = dtp->true_ub;
- dtype_info->true_lb = dtp->true_lb;
- dtype_info->has_sticky_ub = dtp->has_sticky_ub;
- dtype_info->has_sticky_lb = dtp->has_sticky_lb;
-
- MPIU_CHKPMEM_MALLOC(*dataloop, void *, dtp->dataloop_size,
+ MPID_Datatype_get_ptr(target_datatype, dtp);
+ rma_op->dtype_info.is_contig = dtp->is_contig;
+ rma_op->dtype_info.max_contig_blocks = dtp->max_contig_blocks;
+ rma_op->dtype_info.size = dtp->size;
+ rma_op->dtype_info.extent = dtp->extent;
+ rma_op->dtype_info.dataloop_size = dtp->dataloop_size;
+ rma_op->dtype_info.dataloop_depth = dtp->dataloop_depth;
+ rma_op->dtype_info.eltype = dtp->eltype;
+ rma_op->dtype_info.dataloop = dtp->dataloop;
+ rma_op->dtype_info.ub = dtp->ub;
+ rma_op->dtype_info.lb = dtp->lb;
+ rma_op->dtype_info.true_ub = dtp->true_ub;
+ rma_op->dtype_info.true_lb = dtp->true_lb;
+ rma_op->dtype_info.has_sticky_ub = dtp->has_sticky_ub;
+ rma_op->dtype_info.has_sticky_lb = dtp->has_sticky_lb;
+
+ MPIU_CHKPMEM_MALLOC(rma_op->dataloop, void *, dtp->dataloop_size,
mpi_errno, "dataloop");
MPIDI_FUNC_ENTER(MPID_STATE_MEMCPY);
- MPIU_Memcpy(*dataloop, dtp->dataloop, dtp->dataloop_size);
+ MPIU_Memcpy(rma_op->dataloop, dtp->dataloop, dtp->dataloop_size);
MPIDI_FUNC_EXIT(MPID_STATE_MEMCPY);
/* the dataloop can have undefined padding sections, so we need to let
* valgrind know that it is OK to pass this data to writev later on */
- MPL_VG_MAKE_MEM_DEFINED(*dataloop, dtp->dataloop_size);
+ MPL_VG_MAKE_MEM_DEFINED(rma_op->dataloop, dtp->dataloop_size);
get_pkt->dataloop_size = dtp->dataloop_size;
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)get_pkt;
iov[0].MPID_IOV_LEN = sizeof(*get_pkt);
- iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)dtype_info;
- iov[1].MPID_IOV_LEN = sizeof(*dtype_info);
- iov[2].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)*dataloop;
+ iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) &rma_op->dtype_info;
+ iov[1].MPID_IOV_LEN = sizeof(rma_op->dtype_info);
+ iov[2].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)rma_op->dataloop;
iov[2].MPID_IOV_LEN = dtp->dataloop_size;
MPIU_THREAD_CS_ENTER(CH3COMM,vc);
@@ -2583,7 +2446,6 @@ int MPIDI_Win_complete(MPID_Win *win_ptr)
MPIDI_RMA_Op_t *curr_ptr;
MPIDI_RMA_Ops_list_t *ops_list;
MPID_Comm *comm_ptr;
- MPI_Win source_win_handle, target_win_handle;
int start_grp_size, *ranks_in_win_grp, rank;
int nRequest = 0;
int nRequestNew = 0;
@@ -2684,12 +2546,8 @@ int MPIDI_Win_complete(MPID_Win *win_ptr)
flags = MPIDI_CH3_PKT_FLAG_RMA_AT_COMPLETE;
}
- source_win_handle = win_ptr->handle;
- target_win_handle = win_ptr->all_win_handles[curr_ptr->target_rank];
-
#define MPIDI_CH3I_TRACK_RMA_WRITE(op_ptr_, win_ptr_) /* Not used by active mode */
- MPIDI_CH3I_ISSUE_RMA_OP(curr_ptr, win_ptr, flags,
- source_win_handle, target_win_handle, mpi_errno);
+ MPIDI_CH3I_ISSUE_RMA_OP(curr_ptr, win_ptr, flags, mpi_errno);
#undef MPIDI_CH3I_TRACK_RMA_WRITE
i++;
@@ -3075,9 +2933,9 @@ int MPIDI_Win_unlock(int dest, MPID_Win *win_ptr)
if ( MPIR_CVAR_CH3_RMA_MERGE_LOCK_OP_UNLOCK &&
win_ptr->targets[dest].remote_lock_state == MPIDI_CH3_WIN_LOCK_CALLED &&
rma_op && rma_op->next == NULL /* There is only one op */ &&
- rma_op->type != MPIDI_RMA_COMPARE_AND_SWAP &&
- rma_op->type != MPIDI_RMA_FETCH_AND_OP &&
- rma_op->type != MPIDI_RMA_GET_ACCUMULATE )
+ rma_op->pkt.type != MPIDI_CH3_PKT_CAS &&
+ rma_op->pkt.type != MPIDI_CH3_PKT_FOP &&
+ rma_op->pkt.type != MPIDI_CH3_PKT_GET_ACCUM )
{
/* Single put, get, or accumulate between the lock and unlock. If it
* is of small size and predefined datatype at the target, we
@@ -3087,18 +2945,20 @@ int MPIDI_Win_unlock(int dest, MPID_Win *win_ptr)
MPI_Aint type_size;
MPIDI_VC_t *vc;
MPIDI_RMA_Op_t *curr_op = rma_op;
+ MPI_Datatype target_datatype;
MPIDI_Comm_get_vc_set_active(win_ptr->comm_ptr, dest, &vc);
MPID_Datatype_get_size_macro(curr_op->origin_datatype, type_size);
/* msg_sz typically = 65480 */
- if (MPIR_DATATYPE_IS_PREDEFINED(curr_op->target_datatype) &&
+ MPIDI_CH3_PKT_RMA_GET_TARGET_DATATYPE(curr_op->pkt, target_datatype);
+ if (MPIR_DATATYPE_IS_PREDEFINED(target_datatype) &&
(type_size * curr_op->origin_count <= vc->eager_max_msg_sz) ) {
single_op_opt = 1;
/* Set the lock granted flag to 1 */
win_ptr->targets[dest].remote_lock_state = MPIDI_CH3_WIN_LOCK_GRANTED;
- if (curr_op->type == MPIDI_RMA_GET) {
+ if (curr_op->pkt.type == MPIDI_CH3_PKT_GET) {
mpi_errno = send_lock_get(win_ptr, dest);
wait_for_rma_done_pkt = 0;
}
@@ -3583,7 +3443,6 @@ static int do_passive_target_rma(MPID_Win *win_ptr, int target_rank,
{
int mpi_errno = MPI_SUCCESS, nops;
MPIDI_RMA_Op_t *curr_ptr;
- MPI_Win source_win_handle = MPI_WIN_NULL, target_win_handle = MPI_WIN_NULL;
int nRequest=0, nRequestNew=0;
MPIDI_STATE_DECL(MPID_STATE_DO_PASSIVE_TARGET_RMA);
@@ -3614,10 +3473,10 @@ static int do_passive_target_rma(MPID_Win *win_ptr, int target_rank,
/* Check if we can piggyback the RMA done acknowlegdement on the last
operation in the epoch. */
- if (tail->type == MPIDI_RMA_GET ||
- tail->type == MPIDI_RMA_COMPARE_AND_SWAP ||
- tail->type == MPIDI_RMA_FETCH_AND_OP ||
- tail->type == MPIDI_RMA_GET_ACCUMULATE)
+ if (tail->pkt.type == MPIDI_CH3_PKT_GET ||
+ tail->pkt.type == MPIDI_CH3_PKT_CAS ||
+ tail->pkt.type == MPIDI_CH3_PKT_FOP ||
+ tail->pkt.type == MPIDI_CH3_PKT_GET_ACCUM)
{
/* last operation sends a response message. no need to wait
for an additional rma done pkt */
@@ -3633,7 +3492,7 @@ static int do_passive_target_rma(MPID_Win *win_ptr, int target_rank,
curr_ptr = MPIDI_CH3I_RMA_Ops_head(&win_ptr->targets[target_rank].rma_ops_list);
while (curr_ptr != NULL) {
- if (curr_ptr->type == MPIDI_RMA_GET) {
+ if (curr_ptr->pkt.type == MPIDI_CH3_PKT_GET) {
/* Found a GET, move it to the end */
*wait_for_rma_done_pkt = 0;
@@ -3660,10 +3519,6 @@ static int do_passive_target_rma(MPID_Win *win_ptr, int target_rank,
curr_ptr = MPIDI_CH3I_RMA_Ops_head(&win_ptr->targets[target_rank].rma_ops_list);
- if (curr_ptr != NULL) {
- target_win_handle = win_ptr->all_win_handles[curr_ptr->target_rank];
- }
-
while (curr_ptr != NULL)
{
MPIDI_CH3_Pkt_flags_t flags = MPIDI_CH3_PKT_FLAG_NONE;
@@ -3709,8 +3564,6 @@ static int do_passive_target_rma(MPID_Win *win_ptr, int target_rank,
if (*wait_for_rma_done_pkt) {
flags |= MPIDI_CH3_PKT_FLAG_RMA_REQ_ACK;
}
-
- source_win_handle = win_ptr->handle;
}
/* Track passive target write operations. This is used during Win_free
@@ -3719,8 +3572,7 @@ static int do_passive_target_rma(MPID_Win *win_ptr, int target_rank,
#define MPIDI_CH3I_TRACK_RMA_WRITE(op_, win_ptr_) \
do { (win_ptr_)->pt_rma_puts_accs[(op_)->target_rank]++; } while (0)
- MPIDI_CH3I_ISSUE_RMA_OP(curr_ptr, win_ptr, flags, source_win_handle,
- target_win_handle, mpi_errno);
+ MPIDI_CH3I_ISSUE_RMA_OP(curr_ptr, win_ptr, flags, mpi_errno);
#undef MPIDI_CH3I_TRACK_RMA_WRITE
/* If the request is null, we can remove it immediately */
@@ -4020,10 +3872,11 @@ static int send_lock_put_or_acc(MPID_Win *win_ptr, int target_rank)
MPID_Datatype *origin_dtp=NULL;
MPI_Aint origin_type_size;
MPIDI_CH3_Pkt_t upkt;
- MPIDI_CH3_Pkt_lock_put_unlock_t *lock_put_unlock_pkt =
- &upkt.lock_put_unlock;
- MPIDI_CH3_Pkt_lock_accum_unlock_t *lock_accum_unlock_pkt =
- &upkt.lock_accum_unlock;
+ MPIDI_CH3_Pkt_lock_put_unlock_t *lock_put_unlock_pkt = &upkt.lock_put_unlock;
+ MPIDI_CH3_Pkt_lock_accum_unlock_t *lock_accum_unlock_pkt = &upkt.lock_accum_unlock;
+ MPIDI_CH3_Pkt_put_t *put_pkt;
+ MPIDI_CH3_Pkt_accum_t *accum_pkt;
+ MPIDI_CH3_Pkt_accum_immed_t *accumi_pkt;
MPIDI_STATE_DECL(MPID_STATE_SEND_LOCK_PUT_OR_ACC);
@@ -4035,27 +3888,26 @@ static int send_lock_put_or_acc(MPID_Win *win_ptr, int target_rank)
win_ptr->pt_rma_puts_accs[rma_op->target_rank]++;
- if (rma_op->type == MPIDI_RMA_PUT) {
+ if (rma_op->pkt.type == MPIDI_CH3_PKT_PUT) {
+ put_pkt = &rma_op->pkt.put;
+
MPIDI_Pkt_init(lock_put_unlock_pkt, MPIDI_CH3_PKT_LOCK_PUT_UNLOCK);
lock_put_unlock_pkt->flags = MPIDI_CH3_PKT_FLAG_RMA_LOCK |
MPIDI_CH3_PKT_FLAG_RMA_UNLOCK | MPIDI_CH3_PKT_FLAG_RMA_REQ_ACK;
- lock_put_unlock_pkt->target_win_handle =
- win_ptr->all_win_handles[rma_op->target_rank];
+ lock_put_unlock_pkt->target_win_handle = win_ptr->all_win_handles[rma_op->target_rank];
lock_put_unlock_pkt->source_win_handle = win_ptr->handle;
lock_put_unlock_pkt->lock_type = lock_type;
-
- lock_put_unlock_pkt->addr =
- (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
-
- lock_put_unlock_pkt->count = rma_op->target_count;
- lock_put_unlock_pkt->datatype = rma_op->target_datatype;
+ lock_put_unlock_pkt->addr = put_pkt->addr;
+ lock_put_unlock_pkt->count = put_pkt->count;
+ lock_put_unlock_pkt->datatype = put_pkt->datatype;
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) lock_put_unlock_pkt;
iov[0].MPID_IOV_LEN = sizeof(*lock_put_unlock_pkt);
}
- else if (rma_op->type == MPIDI_RMA_ACCUMULATE) {
+ else if (rma_op->pkt.type == MPIDI_CH3_PKT_ACCUMULATE) {
+ accum_pkt = &rma_op->pkt.accum;
+
MPIDI_Pkt_init(lock_accum_unlock_pkt, MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK);
lock_accum_unlock_pkt->flags = MPIDI_CH3_PKT_FLAG_RMA_LOCK |
MPIDI_CH3_PKT_FLAG_RMA_UNLOCK | MPIDI_CH3_PKT_FLAG_RMA_REQ_ACK;
@@ -4063,19 +3915,17 @@ static int send_lock_put_or_acc(MPID_Win *win_ptr, int target_rank)
win_ptr->all_win_handles[rma_op->target_rank];
lock_accum_unlock_pkt->source_win_handle = win_ptr->handle;
lock_accum_unlock_pkt->lock_type = lock_type;
-
- lock_accum_unlock_pkt->addr =
- (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
-
- lock_accum_unlock_pkt->count = rma_op->target_count;
- lock_accum_unlock_pkt->datatype = rma_op->target_datatype;
- lock_accum_unlock_pkt->op = rma_op->op;
+ lock_accum_unlock_pkt->addr = accum_pkt->addr;
+ lock_accum_unlock_pkt->count = accum_pkt->count;
+ lock_accum_unlock_pkt->datatype = accum_pkt->datatype;
+ lock_accum_unlock_pkt->op = accum_pkt->op;
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) lock_accum_unlock_pkt;
iov[0].MPID_IOV_LEN = sizeof(*lock_accum_unlock_pkt);
}
- else if (rma_op->type == MPIDI_RMA_ACC_CONTIG) {
+ else if (rma_op->pkt.type == MPIDI_CH3_PKT_ACCUM_IMMED) {
+ accumi_pkt = &rma_op->pkt.accum_immed;
+
MPIDI_Pkt_init(lock_accum_unlock_pkt, MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK);
lock_accum_unlock_pkt->flags = MPIDI_CH3_PKT_FLAG_RMA_LOCK |
MPIDI_CH3_PKT_FLAG_RMA_UNLOCK | MPIDI_CH3_PKT_FLAG_RMA_REQ_ACK;
@@ -4083,14 +3933,10 @@ static int send_lock_put_or_acc(MPID_Win *win_ptr, int target_rank)
win_ptr->all_win_handles[rma_op->target_rank];
lock_accum_unlock_pkt->source_win_handle = win_ptr->handle;
lock_accum_unlock_pkt->lock_type = lock_type;
-
- lock_accum_unlock_pkt->addr =
- (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
-
- lock_accum_unlock_pkt->count = rma_op->target_count;
- lock_accum_unlock_pkt->datatype = rma_op->target_datatype;
- lock_accum_unlock_pkt->op = rma_op->op;
+ lock_accum_unlock_pkt->addr = accumi_pkt->addr;
+ lock_accum_unlock_pkt->count = accumi_pkt->count;
+ lock_accum_unlock_pkt->datatype = accumi_pkt->datatype;
+ lock_accum_unlock_pkt->op = accumi_pkt->op;
iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) lock_accum_unlock_pkt;
iov[0].MPID_IOV_LEN = sizeof(*lock_accum_unlock_pkt);
@@ -4223,8 +4069,8 @@ static int send_lock_get(MPID_Win *win_ptr, int target_rank)
MPID_Comm *comm_ptr;
MPID_Datatype *dtp;
MPIDI_CH3_Pkt_t upkt;
- MPIDI_CH3_Pkt_lock_get_unlock_t *lock_get_unlock_pkt =
- &upkt.lock_get_unlock;
+ MPIDI_CH3_Pkt_lock_get_unlock_t *lock_get_unlock_pkt = &upkt.lock_get_unlock;
+ MPIDI_CH3_Pkt_get_t *get_pkt;
MPIDI_STATE_DECL(MPID_STATE_SEND_LOCK_GET);
@@ -4259,6 +4105,8 @@ static int send_lock_get(MPID_Win *win_ptr, int target_rank)
request is freed. */
}
+ get_pkt = &rma_op->pkt.get;
+
MPIDI_Pkt_init(lock_get_unlock_pkt, MPIDI_CH3_PKT_LOCK_GET_UNLOCK);
lock_get_unlock_pkt->flags = MPIDI_CH3_PKT_FLAG_RMA_LOCK |
MPIDI_CH3_PKT_FLAG_RMA_UNLOCK; /* FIXME | MPIDI_CH3_PKT_FLAG_RMA_REQ_ACK; */
@@ -4266,13 +4114,9 @@ static int send_lock_get(MPID_Win *win_ptr, int target_rank)
win_ptr->all_win_handles[rma_op->target_rank];
lock_get_unlock_pkt->source_win_handle = win_ptr->handle;
lock_get_unlock_pkt->lock_type = lock_type;
-
- lock_get_unlock_pkt->addr =
- (char *) win_ptr->base_addrs[rma_op->target_rank] +
- win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
-
- lock_get_unlock_pkt->count = rma_op->target_count;
- lock_get_unlock_pkt->datatype = rma_op->target_datatype;
+ lock_get_unlock_pkt->addr = get_pkt->addr;
+ lock_get_unlock_pkt->count = get_pkt->count;
+ lock_get_unlock_pkt->datatype = get_pkt->datatype;
lock_get_unlock_pkt->request_handle = rreq->handle;
comm_ptr = win_ptr->comm_ptr;
@@ -5389,7 +5233,7 @@ int MPIDI_CH3_PktHandler_LockPutUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
new_ptr->source_win_handle = lock_put_unlock_pkt->source_win_handle;
new_ptr->vc = vc;
- new_ptr->pt_single_op->type = MPIDI_RMA_PUT;
+ new_ptr->pt_single_op->type = MPIDI_CH3_PKT_LOCK_PUT_UNLOCK;
new_ptr->pt_single_op->flags = lock_put_unlock_pkt->flags;
new_ptr->pt_single_op->addr = lock_put_unlock_pkt->addr;
new_ptr->pt_single_op->count = lock_put_unlock_pkt->count;
@@ -5543,7 +5387,7 @@ int MPIDI_CH3_PktHandler_LockGetUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
new_ptr->source_win_handle = lock_get_unlock_pkt->source_win_handle;
new_ptr->vc = vc;
- new_ptr->pt_single_op->type = MPIDI_RMA_GET;
+ new_ptr->pt_single_op->type = MPIDI_CH3_PKT_LOCK_GET_UNLOCK;
new_ptr->pt_single_op->flags = lock_get_unlock_pkt->flags;
new_ptr->pt_single_op->addr = lock_get_unlock_pkt->addr;
new_ptr->pt_single_op->count = lock_get_unlock_pkt->count;
@@ -5638,7 +5482,7 @@ int MPIDI_CH3_PktHandler_LockAccumUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
new_ptr->source_win_handle = lock_accum_unlock_pkt->source_win_handle;
new_ptr->vc = vc;
- new_ptr->pt_single_op->type = MPIDI_RMA_ACCUMULATE;
+ new_ptr->pt_single_op->type = MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK;
new_ptr->pt_single_op->flags = lock_accum_unlock_pkt->flags;
new_ptr->pt_single_op->addr = lock_accum_unlock_pkt->addr;
new_ptr->pt_single_op->count = lock_accum_unlock_pkt->count;
-----------------------------------------------------------------------
Summary of changes:
src/mpid/ch3/include/mpidpkt.h | 41 +++-
src/mpid/ch3/include/mpidrma.h | 43 +--
src/mpid/ch3/src/ch3u_handle_recv_req.c | 8 +-
src/mpid/ch3/src/ch3u_rma_acc_ops.c | 92 ++++--
src/mpid/ch3/src/ch3u_rma_ops.c | 104 ++++--
src/mpid/ch3/src/ch3u_rma_sync.c | 576 +++++++++++--------------------
6 files changed, 401 insertions(+), 463 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-110-g006a54b
by noreply@mpich.org 16 Jul '14
by noreply@mpich.org 16 Jul '14
16 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 006a54bd1d330d16f9491dbd59dd3e8486cf7ae2 (commit)
via 5b6a4eee85eca234fcc7a3886ad17c45ac3aaf5d (commit)
via 3131496aab92a8ec2bd510f82c04452f55ab72ea (commit)
via 7ab2a21fa340c71e7e0cc8ca3bf8d50d710585e7 (commit)
from 1cc48e34f182c08ada0ce554fce35c545d336817 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/006a54bd1d330d16f9491dbd59dd3e848…
commit 006a54bd1d330d16f9491dbd59dd3e8486cf7ae2
Author: Paul Coffman <pkcoff(a)us.ibm.com>
Date: Tue Jul 15 15:47:32 2014 -0500
BALANCECONTIG cleanups/fixes
use ADIOI_Assert to guard againt infinite loop; simpler easier-to-read
code for fd_size assignment
Signed-off-by: Rob Latham <robl(a)mcs.anl.gov>
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c
index dc2b22e..48f98b8 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c
@@ -331,6 +331,7 @@ void ADIOI_GPFS_Calc_file_domains(ADIO_File fd,
* ion as well */
for (j=0;j<naggs_large;j++) {
int foundbridge = 0;
+ int numbridgelistpasses = 0;
while (!foundbridge) {
if (tmpbridgelistnum[bridgeiter] > 0) {
foundbridge = 1;
@@ -339,12 +340,21 @@ void ADIOI_GPFS_Calc_file_domains(ADIO_File fd,
printf("naggs is %d bridgeiter is %d bridgelistoffset[bridgeiter] is %d tmpbridgelistnum[bridgeiter] is %d\n",naggs, bridgeiter,bridgelistoffset[bridgeiter],tmpbridgelistnum[bridgeiter]);
printf("naggs is %d bridgeiter is %d setting fd_size[%d]\n",naggs, bridgeiter,bridgelistoffset[bridgeiter]+(fd->hints->bridgelistnum[bridgeiter]-tmpbridgelistnum[bridgeiter]));
*/
- fd_size[bridgelistoffset[bridgeiter]+(fd->hints->fs_hints.bg.bridgelistnum[bridgeiter]-tmpbridgelistnum[bridgeiter])] =
- (nb_cn_small+1) * blksize;
+ int currentbridgelistnum =
+ (fd->hints->fs_hints.bg.bridgelistnum[bridgeiter]-
+ tmpbridgelistnum[bridgeiter]);
+ int currentfdsizeindex = bridgelistoffset[bridgeiter] +
+ currentbridgelistnum;
+ fd_size[currentfdsizeindex] = (nb_cn_small+1) * blksize;
tmpbridgelistnum[bridgeiter]--;
}
- if (bridgeiter == (fd->hints->fs_hints.bg.numbridges-1))
+ if (bridgeiter == (fd->hints->fs_hints.bg.numbridges-1)) {
+ /* guard against infinite loop - should only ever make 1 pass
+ * thru bridgelist */
+ ADIOI_Assert(numbridgelistpasses == 0);
+ numbridgelistpasses++;
bridgeiter = 0;
+ }
else
bridgeiter++;
}
http://git.mpich.org/mpich.git/commitdiff/5b6a4eee85eca234fcc7a3886ad17c45a…
commit 5b6a4eee85eca234fcc7a3886ad17c45ac3aaf5d
Author: Paul Coffman <pkcoff(a)us.ibm.com>
Date: Fri Jul 11 23:53:22 2014 -0500
resource cleanup in p2pcontig case
P2PCONTIG memory leak fixes - MPI_Request cleanups via MPI_Wait for MPI_Isends
Signed-off-by: Rob Latham <robl(a)mcs.anl.gov>
diff --git a/src/mpi/romio/adio/common/p2p_aggregation.c b/src/mpi/romio/adio/common/p2p_aggregation.c
index 20caf8d..b8e00e8 100644
--- a/src/mpi/romio/adio/common/p2p_aggregation.c
+++ b/src/mpi/romio/adio/common/p2p_aggregation.c
@@ -146,6 +146,7 @@ void ADIOI_P2PContigWriteAggregation(ADIO_File fd,
MPI_Request *mpiSendDataToTargetAggRequest = (MPI_Request *) ADIOI_Malloc(numTargetAggs * sizeof(MPI_Request));
MPI_Status mpiWaitAnyStatusFromTargetAggs,mpiWaitAnyStatusFromSourceProcs;
+ MPI_Status mpiIsendStatusForSize, mpiIsendStatusForData;
// use the write buffer allocated in the file_open
char *write_buf0 = fd->io_buf;
@@ -176,6 +177,7 @@ void ADIOI_P2PContigWriteAggregation(ADIO_File fd,
int *dataSizeGottenThisRoundPerProc = (int *)ADIOI_Malloc(numSourceProcs * sizeof(int));
int *mpiRequestMapPerProc = (int *)ADIOI_Malloc(numSourceProcs * sizeof(int));
+ int *mpiSendRequestMapPerProc = (int *)ADIOI_Malloc(numTargetAggs * sizeof(int));
#ifdef ROMIO_GPFS
endTimeBase = MPI_Wtime();
@@ -201,7 +203,7 @@ void ADIOI_P2PContigWriteAggregation(ADIO_File fd,
}
int numRecvToWaitFor = 0;
- int irecv;
+ int irecv,isend;
/* the source procs receive the amount of data the aggs want them to send */
#ifdef ROMIO_GPFS
@@ -242,7 +244,9 @@ void ADIOI_P2PContigWriteAggregation(ADIO_File fd,
}
- // the source procs send the requested data to the aggs - only send if requested more than 0 bytes
+ int numDataSendToWaitFor = 0;
+ /* the source procs send the requested data to the aggs - only send if
+ * requested more than 0 bytes */
for (i = 0; i < numRecvToWaitFor; i++) {
MPI_Waitany(numRecvToWaitFor,mpiSizeToSendRequest,&irecv,&mpiWaitAnyStatusFromTargetAggs);
@@ -255,6 +259,8 @@ void ADIOI_P2PContigWriteAggregation(ADIO_File fd,
targetAggsForMyData[irecv],0,fd->comm,&mpiSendDataToTargetAggRequest[irecv]);
totalAmountDataSent += amountOfDataReqestedByTargetAgg[irecv];
bufferOffsetToSendPerTargetAgg[irecv] += amountOfDataReqestedByTargetAgg[irecv];
+ mpiSendRequestMapPerProc[numDataSendToWaitFor] = irecv;
+ numDataSendToWaitFor++;
}
}
@@ -308,6 +314,14 @@ void ADIOI_P2PContigWriteAggregation(ADIO_File fd,
}
+ /* clean up the MPI_Request object for the MPI_Isend which told the
+ * source procs how much data to send */
+ for (i=0;i<numSourceProcs;i++) {
+ MPI_Waitany(numSourceProcs,mpiSendDataSizeRequest,
+ &isend,&mpiIsendStatusForSize);
+ }
+
+
#ifdef ROMIO_GPFS
endTimeBase = MPI_Wtime();
gpfsmpio_prof_cw[GPFSMPIO_CIO_T_DEXCH_NET] += (endTimeBase-startTimeBase);
@@ -361,6 +375,10 @@ void ADIOI_P2PContigWriteAggregation(ADIO_File fd,
if (iAmUsedAgg)
currentRoundFDStart += coll_bufsize;
+ for (i = 0; i < numDataSendToWaitFor; i++) {
+ MPI_Wait(&mpiSendDataToTargetAggRequest[mpiSendRequestMapPerProc[i]],
+ &mpiIsendStatusForData);
+ }
} // for-loop roundIter
@@ -396,6 +414,7 @@ void ADIOI_P2PContigWriteAggregation(ADIO_File fd,
ADIOI_Free(mpiSendDataToTargetAggRequest);
ADIOI_Free(dataSizeGottenThisRoundPerProc);
ADIOI_Free(mpiRequestMapPerProc);
+ ADIOI_Free(mpiSendRequestMapPerProc);
/* TODO: still need a barrier here? */
MPI_Barrier(fd->comm);
@@ -544,7 +563,7 @@ void ADIOI_P2PContigReadAggregation(ADIO_File fd,
MPI_Request *mpiSendDataSizeRequest = (MPI_Request *) ADIOI_Malloc(numTargetProcs * sizeof(MPI_Request));
MPI_Request *mpiSendDataToTargetProcRequest = (MPI_Request *) ADIOI_Malloc(numTargetProcs * sizeof(MPI_Request));
- MPI_Status mpiWaitAnyStatusFromTargetAggs,mpiWaitAnyStatusFromSourceProcs;
+ MPI_Status mpiWaitAnyStatusFromTargetAggs,mpiWaitAnyStatusFromSourceProcs,mpiIsendStatusForSize,mpiIsendStatusForData;
/* use the two-phase buffer allocated in the file_open - no app should ever
* be both reading and writing at the same time */
@@ -590,7 +609,7 @@ void ADIOI_P2PContigReadAggregation(ADIO_File fd,
int roundIter;
for (roundIter=0;roundIter<numberOfRounds;roundIter++) {
- int irecv;
+ int irecv,isend;
// determine what offsets define the portion of the file domain the agg is reading this round
if (iAmUsedAgg) {
@@ -768,6 +787,16 @@ void ADIOI_P2PContigReadAggregation(ADIO_File fd,
nextRoundFDStart = currentRoundFDStart + coll_bufsize;
+
+ // clean up the MPI_Isend MPI_Requests
+ for (i=0;i<numTargetProcs;i++) {
+ MPI_Waitany(numTargetProcs,mpiSendDataSizeRequest,
+ &isend,&mpiIsendStatusForSize);
+ if (dataSizeSentThisRoundPerProc[isend] > 0) {
+ MPI_Wait(&mpiSendDataToTargetProcRequest[isend],&mpiIsendStatusForData);
+ }
+ }
+
MPI_Barrier(fd->comm); // need to sync up the source aggs which did the isend with the target procs which did the irecvs to give the target procs time to get the data before overwriting with next round readcontig
} // for-loop roundIter
http://git.mpich.org/mpich.git/commitdiff/3131496aab92a8ec2bd510f82c04452f5…
commit 3131496aab92a8ec2bd510f82c04452f55ab72ea
Author: Paul Coffman <pkcoff(a)us.ibm.com>
Date: Fri Jul 11 14:27:53 2014 -0500
small memory leak on Blue Gene
The BGQPLATFORM bridgelist and bridgelistnum hints need to be freed in
ADIOI_Close because of the way the "create on one, reopen on all" logic
and the hint processing logic interact.
Signed-off-by: Rob Latham <robl(a)mcs.anl.gov>
diff --git a/src/mpi/romio/adio/common/ad_close.c b/src/mpi/romio/adio/common/ad_close.c
index 62e18f9..c34ffa3 100644
--- a/src/mpi/romio/adio/common/ad_close.c
+++ b/src/mpi/romio/adio/common/ad_close.c
@@ -64,6 +64,20 @@ void ADIO_Close(ADIO_File fd, int *error_code)
if (fd->hints && fd->hints->ranklist) ADIOI_Free(fd->hints->ranklist);
if (fd->hints && fd->hints->cb_config_list) ADIOI_Free(fd->hints->cb_config_list);
+ /* This BlueGene platform-specific free must be done in the common code
+ * because the malloc's for these hint data structures are done at the
+ * scope of ADIO_Open within the SetInfo call (ADIOI_GPFS_SetInfo which
+ * calls ADIOI_BG_gen_agg_ranklist). They cannot be done in the
+ * ADIOI_GPFS_Close because of the file creation case where the
+ * ADIOI_GPFS_Close and re-open via ADIOI_GPFS_Open are done which results
+ * in a double-free - ADIOI_GPFS_Open does not redo the SetInfo... */
+#ifdef BGQPLATFORM
+ if (fd->hints && fd->hints->fs_hints.bg.bridgelist)
+ ADIOI_Free(fd->hints->fs_hints.bg.bridgelist);
+ if (fd->hints && fd->hints->fs_hints.bg.bridgelistnum)
+ ADIOI_Free(fd->hints->fs_hints.bg.bridgelistnum);
+#endif
+
/* Persistent File Realms */
if (fd->hints->cb_pfr == ADIOI_HINT_ENABLE) {
/* AAR, FSIZE, and User provided uniform File realms */
http://git.mpich.org/mpich.git/commitdiff/7ab2a21fa340c71e7e0cc8ca3bf8d50d7…
commit 7ab2a21fa340c71e7e0cc8ca3bf8d50d710585e7
Author: Paul Coffman <pkcoff(a)us.ibm.com>
Date: Mon Jul 7 20:27:30 2014 -0500
clean up resources if P2PContig selected
After a call to ADIOI_P2PContig(Write/Read)Aggregation, code exits early
from ADIOI_GPFS_(Write/Read)StridedColl and was not freeing some data
structures
Signed-off-by: Rob Latham <robl(a)mcs.anl.gov>
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
index 938a133..71ddb9a 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c
@@ -292,6 +292,14 @@ void ADIOI_GPFS_ReadStridedColl(ADIO_File fd, void *buf, int count,
/* NOTE: we are skipping the rest of two-phase in this path */
GPFSMPIO_T_CIO_REPORT( 0, fd, myrank, nprocs)
+
+ ADIOI_Free(offset_list);
+ ADIOI_Free(len_list);
+ ADIOI_Free(st_offsets);
+ ADIOI_Free(end_offsets);
+ ADIOI_Free(fd_start);
+ ADIOI_Free(fd_end);
+
return;
}
}
diff --git a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
index eef476d..436d01d 100644
--- a/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
+++ b/src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c
@@ -278,6 +278,14 @@ void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count,
error_code, st_offsets, end_offsets, fd_start, fd_end);
/* NOTE: we are skipping the rest of two-phase in this path */
GPFSMPIO_T_CIO_REPORT( 1, fd, myrank, nprocs)
+
+ ADIOI_Free(offset_list);
+ ADIOI_Free(len_list);
+ ADIOI_Free(st_offsets);
+ ADIOI_Free(end_offsets);
+ ADIOI_Free(fd_start);
+ ADIOI_Free(fd_end);
+
return;
}
}
-----------------------------------------------------------------------
Summary of changes:
src/mpi/romio/adio/ad_gpfs/ad_gpfs_aggrs.c | 16 +++++++++--
src/mpi/romio/adio/ad_gpfs/ad_gpfs_rdcoll.c | 8 ++++++
src/mpi/romio/adio/ad_gpfs/ad_gpfs_wrcoll.c | 8 ++++++
src/mpi/romio/adio/common/ad_close.c | 14 ++++++++++
src/mpi/romio/adio/common/p2p_aggregation.c | 37 ++++++++++++++++++++++++---
5 files changed, 76 insertions(+), 7 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-106-g1cc48e3
by noreply@mpich.org 16 Jul '14
by noreply@mpich.org 16 Jul '14
16 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 1cc48e34f182c08ada0ce554fce35c545d336817 (commit)
from 142b944024cbac4f6fc2cfc989b5404c52f7d1cc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/1cc48e34f182c08ada0ce554fce35c545…
commit 1cc48e34f182c08ada0ce554fce35c545d336817
Author: Sameh Sharkawi <sssharka(a)us.ibm.com>
Date: Tue Jul 15 16:40:17 2014 -0400
pamid: Fix for pami_tune parameter parsing
(ibm) D197049
Signed-off-by: Michael Blocksome <blocksom(a)us.ibm.com>
diff --git a/src/mpid/pamid/src/mpidi_util.c b/src/mpid/pamid/src/mpidi_util.c
index 45a36d0..8217ade 100644
--- a/src/mpid/pamid/src/mpidi_util.c
+++ b/src/mpid/pamid/src/mpidi_util.c
@@ -1288,14 +1288,14 @@ int num_tasks;
static int MPIDI_collsel_print_usage()
{
if(!task_id)
- fputs("Usage: pami_tune [options]\n\
+ fputs("Usage: pami_tune (MPICH) [options]\n\
Options:\n\
-c Comma separated list of collectives to benchmark\n\
Valid options are: \n\
- allgather, allgatherv, allgatherv_int, allreduce, alltoall,\n\
- alltoallv, alltoallv_int, ambroadcast, amgather, amreduce,\n\
- amscatter, barrier, broadcast, gather, gatherv, gatherv_int,\n\
- reduce, reduce_scatter, scan, scatter, scatterv, scatterv_int\n\
+ allgather, allgatherv_int, allreduce, alltoall,\n\
+ alltoallv_int, ambroadcast, amgather, amreduce,\n\
+ amscatter, barrier, broadcast, gather, gatherv_int,\n\
+ reduce, reduce_scatter, scan, scatter, scatterv_int\n\
(Default: all collectives)\n\n\
-m Comma separated list of message sizes to benchmark\n\
(Default: 1 to 2^k, where k <= 20)\n\n\
@@ -1394,6 +1394,7 @@ static int MPIDI_collsel_process_collectives(char *coll_arg, advisor_params_t *p
coll = strtok(collectives,",");
while (coll != NULL)
{
+ int invalid_collective = 0;
for(i=0; i<PAMI_XFER_COUNT; i++)
{
if(strcmp(coll, xfer_array_str[i]) == 0)
@@ -1402,24 +1403,28 @@ static int MPIDI_collsel_process_collectives(char *coll_arg, advisor_params_t *p
{
if(infolevel >= 1)
fprintf(stderr,"WARNING: MPICH (pami_tune) doesn't support tuning for ALLGATHERV. ALLGATHERV tuning will be skipped.\nTune for ALLGATHERV_INT instead\n");
+ invalid_collective = 1;
break;
}
else if(i == 7)
{
if(infolevel >= 1)
fprintf(stderr,"WARNING: MPICH (pami_tune) doesn't support tuning for SCATTERV. SCATTERV tuning will be skipped.\nTune for SCATTERV_INT instead\n");
+ invalid_collective = 1;
break;
}
else if(i == 10)
{
if(infolevel >= 1)
fprintf(stderr,"WARNING: MPICH (pami_tune) doesn't support tuning for GATHERV. GATHERV tuning will be skipped.\nTune for GATHERV_INT instead\n");
+ invalid_collective = 1;
break;
}
else if(i == 14)
{
if(infolevel >= 1)
fprintf(stderr,"WARNING: MPICH (pami_tune) doesn't support tuning for ALLTOALLV. ALLTOALLV tuning will be skipped.\nTune for ALLTOALLV_INT instead\n");
+ invalid_collective = 1;
break;
}
else
@@ -1430,19 +1435,23 @@ static int MPIDI_collsel_process_collectives(char *coll_arg, advisor_params_t *p
}
}
/* arg did not match any collective */
- if(i == PAMI_XFER_COUNT)
+ if(i == PAMI_XFER_COUNT || invalid_collective)
{
- MPIU_Free(params->collectives);
- params->collectives = NULL;
if(!task_id)
{
fprintf(stderr, "Invalid collective: %s\n", coll);
}
- ret = 1;
break;
}
coll = strtok(NULL,",");
}
+ if(params->num_collectives == 0)
+ {
+ MPIU_Free(params->collectives);
+ params->collectives = NULL;
+ ret = 1;
+ }
+
MPIU_Free(collectives);
return ret;
}
-----------------------------------------------------------------------
Summary of changes:
src/mpid/pamid/src/mpidi_util.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-105-g142b944
by noreply@mpich.org 16 Jul '14
by noreply@mpich.org 16 Jul '14
16 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 142b944024cbac4f6fc2cfc989b5404c52f7d1cc (commit)
from 7669873d2dadd04dd8509aa5939d68f24eef4c32 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/142b944024cbac4f6fc2cfc989b5404c5…
commit 142b944024cbac4f6fc2cfc989b5404c52f7d1cc
Author: Rob Latham <robl(a)mcs.anl.gov>
Date: Tue Jul 15 09:54:24 2014 -0500
Revert "Address many of the perf problems in #1788"
This reverts commit 1c5c594554343a0b6b4335cb28790aa51ab8a968.
Reopens #1788 (datatype performance tests failing)
but better to have poor performance than incorrect performance
Closes #2115 (RMA fails with derived type containing struct of struct)
Closes #2126 (Data Integrity issue in MPI_Gather ...)
Conflicts:
src/mpid/common/datatype/dataloop/dataloop_optimize.c
but only because a subsequent commit removed bits of this optimization.
This commit fully removes this optimization, but we leave behind test
cases to help us make sure we get it right next time. We also leave
behind some additional debugging support routines.
Signed-off-by: Junchao Zhang <jczhang(a)mcs.anl.gov>
diff --git a/src/mpid/common/datatype/dataloop/Makefile.mk b/src/mpid/common/datatype/dataloop/Makefile.mk
index 6cb8799..8bf212a 100644
--- a/src/mpid/common/datatype/dataloop/Makefile.mk
+++ b/src/mpid/common/datatype/dataloop/Makefile.mk
@@ -21,8 +21,7 @@ mpi_core_sources += \
src/mpid/common/datatype/dataloop/segment_count.c \
src/mpid/common/datatype/dataloop/segment_flatten.c \
src/mpid/common/datatype/dataloop/segment_packunpack.c \
- src/mpid/common/datatype/dataloop/subarray_support.c \
- src/mpid/common/datatype/dataloop/dataloop_optimize.c
+ src/mpid/common/datatype/dataloop/subarray_support.c
# several headers are included by the rest of MPICH
AM_CPPFLAGS += -I$(top_srcdir)/src/mpid/common/datatype
diff --git a/src/mpid/common/datatype/dataloop/dataloop_create.h b/src/mpid/common/datatype/dataloop/dataloop_create.h
index 0815b0b..414e849 100644
--- a/src/mpid/common/datatype/dataloop/dataloop_create.h
+++ b/src/mpid/common/datatype/dataloop/dataloop_create.h
@@ -88,22 +88,11 @@ DLOOP_Count PREPEND_PREFIX(Type_indexed_count_contig)(DLOOP_Count count,
const void *displacement_array,
int dispinbytes,
DLOOP_Offset old_extent);
-
+
DLOOP_Count PREPEND_PREFIX(Type_blockindexed_count_contig)(DLOOP_Count count,
DLOOP_Count blklen,
const void *disp_array,
int dispinbytes,
DLOOP_Offset old_extent);
-int PREPEND_PREFIX(Dataloop_optimize)( DLOOP_Dataloop *dlpOld_p, int level );
-
-int PREPEND_PREFIX(Dataloop_est_complexity)(DLOOP_Dataloop *,
- MPI_Aint *, MPI_Aint *);
-int PREPEND_PREFIX(Dataloop_est_struct_complexity)( int,
- const int [],
- const DLOOP_Type [],
- MPI_Aint *,
- MPI_Aint * );
-
-void PREPEND_PREFIX(Dataloop_debug_print)( DLOOP_Dataloop *dp );
#endif
diff --git a/src/mpid/common/datatype/dataloop/dataloop_create_struct.c b/src/mpid/common/datatype/dataloop/dataloop_create_struct.c
index 70054b6..7d51b7b 100644
--- a/src/mpid/common/datatype/dataloop/dataloop_create_struct.c
+++ b/src/mpid/common/datatype/dataloop/dataloop_create_struct.c
@@ -11,57 +11,6 @@
#error "You must explicitly include a header that sets the PREPEND_PREFIX and includes dataloop_parts.h"
#endif
-
-/*
-=== BEGIN_MPI_T_CVAR_INFO_BLOCK ===
-
-categories :
- - name : DATATYPE
- description : Datatype optimization parameters
-
-cvars:
- - name : MPIR_CVAR_DATALOOP_OPTIMIZE
- category : DATATYPE
- type : boolean
- default : true
- class : none
- verbosity : MPI_T_VERBOSITY_USER_BASIC
- scope : MPI_T_SCOPE_LOCAL
- description : >-
- By default, the internal representation of an MPI datatype that
- is used by MPICH to move data is very similar to the original
- description of the datatype. If this flag is true, additional
- optimizations are used to improve the performance of datatypes.
-
- - name : MPIR_CVAR_DATALOOP_FLATTEN
- category : DATATYPE
- type : boolean
- class : none
- default : true
- verbosity : MPI_T_VERBOSITY_USER_BASIC
- scope : MPI_T_SCOPE_LOCAL
- description : >-
- If true, attempt to "flatten" the internal representation of
- MPI struct datatypes (created with MPI_Type_create_struct).
-
- - name : MPIR_CVAR_DATALOOP_FLATTEN_MULT
- category : DATATYPE
- type : int
- class : none
- default : 2
- verbosity : MPI_T_VERBOSITY_USER_BASIC
- scope : MPI_T_SCOPE_LOCAL
- description : >-
- Flattening an MPI struct datatype does not always improve
- performance. This parameter is a threshold that is used in
- comparing the size of the description with the amount of data
- moved. Larger values make it more likely that a struct datatype
- will be flattened. The default value is adequate for flattening
- simple structs, and will usually avoid flattening structs
- containing vectors or block-indexed data.
-
-=== END_MPI_T_CVAR_INFO_BLOCK ===
-*/
static int DLOOP_Dataloop_create_struct_memory_error(void);
static int DLOOP_Dataloop_create_unique_type_struct(DLOOP_Count count,
const int *blklens,
@@ -289,37 +238,19 @@ int PREPEND_PREFIX(Dataloop_create_struct)(DLOOP_Count count,
* if caller asked for homogeneous or all bytes representation,
* flatten the type and store it as an indexed type so that
* there are no branches in the dataloop tree.
- *
- * Note that this is not always an optimization - for example,
- * replacing two long block_indexed with one longer indexed (with
- * the additional blockcount array) is likely to be slower, because
- * of the additional memory motion required.
*/
- if (MPIR_CVAR_DATALOOP_FLATTEN && (
- (flag == DLOOP_DATALOOP_HOMOGENEOUS) ||
- (flag == DLOOP_DATALOOP_ALL_BYTES) ))
- {
- MPI_Aint nElms = 0, nDesc = 0;
- PREPEND_PREFIX(Dataloop_est_struct_complexity)( count,
- blklens,
- oldtypes,
- &nElms,
- &nDesc );
-
- /* Only convert to flattened if the flattened description
- is likely to be more efficient. The magic number of 24 was
- determined emperically. */
- if ( nDesc * 24 * MPIR_CVAR_DATALOOP_FLATTEN_MULT > nElms) {
- return DLOOP_Dataloop_create_flattened_struct(count,
- blklens,
- disps,
- oldtypes,
- dlp_p,
- dlsz_p,
- dldepth_p,
- flag);
- }
- }
+ if ((flag == DLOOP_DATALOOP_HOMOGENEOUS) ||
+ (flag == DLOOP_DATALOOP_ALL_BYTES))
+ {
+ return DLOOP_Dataloop_create_flattened_struct(count,
+ blklens,
+ disps,
+ oldtypes,
+ dlp_p,
+ dlsz_p,
+ dldepth_p,
+ flag);
+ }
/* scan through types and gather derived type info */
for (i=0; i < count; i++)
diff --git a/src/mpid/common/datatype/dataloop/dataloop_optimize.c b/src/mpid/common/datatype/dataloop/dataloop_optimize.c
deleted file mode 100644
index 29be813..0000000
--- a/src/mpid/common/datatype/dataloop/dataloop_optimize.c
+++ /dev/null
@@ -1,668 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-
-/*
- * (C) 2013 by Argonne National Laboratory.
- * See COPYRIGHT in top-level directory.
- */
-
-#include "dataloop.h"
-
-/* #define MPICH_DEBUG_DATALOOP */
-#ifdef MPICH_DEBUG_DATALOOP
-static int firstCall = 1;
-static int printDataloop = 0;
-static int printIfOptimized = 0;
-
-/* Print format:
- (spaces for level).(el_size,el_extent,el_type)(count)....
-*/
-static void dl_print_dataloop( int, int, DLOOP_Dataloop * );
-static void dl_print_contig( int, DLOOP_Dataloop * );
-static void dl_print_vector( int, DLOOP_Dataloop * );
-static void dl_print_blockindexed( int, DLOOP_Dataloop * );
-static void dl_print_struct( int, DLOOP_Dataloop * );
-static void dl_print( int, const char * );
-
-static void dl_print_tab( int l )
-{
- int i;
- for (i=2*l; i!=0; i--) printf( "%c", ' ' );
-}
-static void dl_print_base( DLOOP_Dataloop *dp )
-{
- printf( "(%ld,%ld,%lx)(%ld)", (long)dp->el_size, (long)dp->el_extent,
- (long)dp->el_type, (long)dp->loop_params.count );
-}
-static void dl_print( int l, const char *s )
-{
- dl_print_tab(l);
- printf( "%s", s );
-}
-static void dl_print_contig( int l, DLOOP_Dataloop *dp )
-{
- dl_print_tab(l);
- printf( "CONTIG " );
- dl_print_base( dp );
- printf( "\n" );
-}
-static void dl_print_vector( int l, DLOOP_Dataloop *dp )
-{
- int stride = dp->loop_params.v_t.stride;
- int blocksize = dp->loop_params.v_t.blocksize ;
- dl_print_tab(l);
- printf( "VECTOR " );
- dl_print_base( dp );
- printf( ":Stride %d Blocksize %d\n", stride, blocksize );
-}
-static void dl_print_blockindexed( int l, DLOOP_Dataloop *dp )
-{
- int blocksize = dp->loop_params.bi_t.blocksize ;
- DLOOP_Offset *offarray = dp->loop_params.bi_t.offset_array;
- int i, n;
- dl_print_tab(l);
- printf( "BLOCKINDEXED " );
- dl_print_base( dp );
- printf( ":Blocksize %d:", blocksize );
- n = dp->loop_params.bi_t.count;
- if (n > 8) n = 8;
- for (i=0; i<n; i++) {
- printf( "%lx,", (long)offarray[i] );
- }
- if (dp->loop_params.bi_t.count > n) printf( "..." );
- printf( "\n" );
-}
-static void dl_print_indexed( int l, DLOOP_Dataloop *dp )
-{
- DLOOP_Count *blocksizearray = dp->loop_params.i_t.blocksize_array ;
- DLOOP_Offset *offarray = dp->loop_params.i_t.offset_array;
- int i, n;
- int minblock, maxblock;
- dl_print_tab(l);
- printf( "INDEXED " );
- dl_print_base( dp );
- n = dp->loop_params.i_t.count;
- minblock = maxblock = (n>0) ? blocksizearray[0] : 0;
- for (i=0; i<n; i++) {
- if (blocksizearray[i] > maxblock) maxblock = blocksizearray[i];
- if (blocksizearray[i] < minblock) minblock = blocksizearray[i];
- }
- printf( "blocks in [%d,%d]", minblock, maxblock );
-
- if (n > 8) n = 8;
- for (i=0; i<n; i++) {
- printf( "(%lx,%ld)", (long)offarray[i], (long)blocksizearray[i] );
- }
- if (dp->loop_params.i_t.count > n) printf( "..." );
- printf( "\n" );
-}
-
-static void dl_print_struct( int l, DLOOP_Dataloop *dp )
-{
- DLOOP_Count *blocksizearray = dp->loop_params.s_t.blocksize_array ;
- DLOOP_Offset *offarray = dp->loop_params.s_t.offset_array;
- DLOOP_Dataloop **looparray = dp->loop_params.s_t.dataloop_array;
- int i, n;
- dl_print_tab(l);
- printf( "STRUCT " );
- dl_print_base( dp );
- printf( "\n" );
- n = dp->loop_params.i_t.count;
- if (n > 8) n = 8;
- for (i=0; i<n; i++) {
- dl_print_tab(l+1);
- printf( "(%lx,%ld):\n", (long)offarray[i], (long)blocksizearray[i] );
- dl_print_dataloop( l+1, 0, looparray[i] );
- }
- if (dp->loop_params.i_t.count > n) printf( "...\n" );
-}
-static void dl_print_dataloop( int l, int doBase, DLOOP_Dataloop *dp )
-{
- dl_print_tab( l );
- if (doBase)
- dl_print_base( dp );
- switch (dp->kind & DLOOP_KIND_MASK) {
- case DLOOP_KIND_CONTIG:
- dl_print_contig( l, dp );
- break;
- case DLOOP_KIND_VECTOR:
- dl_print_vector( l, dp );
- break;
- case DLOOP_KIND_BLOCKINDEXED:
- dl_print_blockindexed( l, dp );
- break;
- case DLOOP_KIND_INDEXED:
- dl_print_indexed( l, dp );
- break;
- case DLOOP_KIND_STRUCT:
- dl_print_struct( l, dp );
- break;
- default:
- dl_print( l, "Unknown dataloop type " );
- printf( "\n" );
- break;
- }
-}
-#endif
-
-void PREPEND_PREFIX(Dataloop_debug_print)( DLOOP_Dataloop *dp )
-{
-#ifdef MPICH_DEBUG_DATALOOP
- if (firstCall) {
- char *s = getenv( "MPICH_DATALOOP_PRINT" );
- if (s && (strcmp(s,"yes")==0 || strcmp(s,"YES") == 0)) {
- printDataloop = 1;
- printIfOptimized = 1;
- }
- firstCall = 0;
- }
- if (printDataloop) {
- printf( "In Dataloop_debug_print:\n" );
- dl_print_dataloop( 1, 0, dp );
- }
-#endif
-}
-
-/*
- * Indicates whether a dataloop is a basic and final contig type.
- * This can be used to determine when a contig type can be removed
- * in a dataloop.
- */
-static int dl_contig_isFinal( DLOOP_Dataloop *dp )
-{
- if ((dp->kind & DLOOP_KIND_MASK) != DLOOP_KIND_CONTIG) return 0;
- if (dp->el_size == dp->el_extent &&
- (dp->kind & DLOOP_FINAL_MASK))
- return 1;
- return 0;
-}
-
-
-/*
- * Optimize a dataloop
- *
- * Apply the following transformations and return a new dataloop.
- * 1. Convert all predefined types to UINTS with the best alignment (may be BYTE
- * in worst case)
- * 2. Convert blocks of contiguous into a single block of basic unit (e.g.,
- * a vector type with a block count of 27 applied to a contiguous type of
- * 6 ints will be turned into a block count of (27*6) UINTs)
- * 3. Convert struct (with different dataloops (from different MPI datatypes)
- * into indexed when all types are contig
- * 4. Convert dataloops with counts of 1 into simpler types (e.g., q vector
- * with 1 element is really a contig type)
- *
- * Value of these optimizations
- * A 2012 paper[1] compared performance of Open MPI, MPICH2, and user-written code
- * for some datatypes, and found MPICH2 often performed poorer than other
- * options. An investigation showed that some of the issues are due to
- * a failure to perform optimizations of these type (especially #1 and 2).
- * It may also be necessary to enhance the dataloop execution engine, but
- * that will b a separate step.
- *
- * [1] T. Schneider and R. Gerstenberger and T. Hoefler, "Micro-Applications
- * for Communication Data Access Patterns and MPI Datatypes", EuroMPI 2012
- *
- * The level argument is used primarily for debugging output; it keeps track
- * of how deep a recursive application of this routine has gone.
- */
-int PREPEND_PREFIX(Dataloop_optimize)(DLOOP_Dataloop *dlpOld_p, int level )
-{
- int i;
-
-#ifdef MPICH_DEBUG_DATALOOP
- /* Temp for debugging */
- /* This is threadsafe in the sense that we don't care */
- if (firstCall) {
- char *s = getenv( "MPICH_DATALOOP_PRINT" );
- if (s && (strcmp(s,"yes")==0 || strcmp(s,"YES") == 0)) {
- printDataloop = 1;
- printIfOptimized = 1;
- }
- firstCall = 0;
- }
- if (printDataloop && level == 0)
- printf( "About to optimize in commit...\n" );
-#endif
-
- switch (dlpOld_p->kind & DLOOP_KIND_MASK) {
- case DLOOP_KIND_CONTIG:
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- dl_print_contig( level, dlpOld_p );
-#endif
- /* replace contig of (non-basic) contig with contig (basic) */
- if (!(dlpOld_p->kind & DLOOP_FINAL_MASK)) {
- DLOOP_Dataloop *dlpChild_p = dlpOld_p->loop_params.c_t.dataloop;
- PREPEND_PREFIX(Dataloop_optimize)( dlpChild_p, level+1 );
- if ((dlpChild_p->kind & DLOOP_KIND_MASK) == DLOOP_KIND_CONTIG &&
- dl_contig_isFinal( dlpChild_p )) {
- if (dlpOld_p->el_size == dlpOld_p->el_extent &&
- !MPIU_Prod_overflows_max(
- dlpChild_p->loop_params.c_t.count,
- dlpOld_p->loop_params.c_t.count,
- INT_MAX ) ) {
-
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- printf( "replacing with contig\n" );
-#endif
- dlpOld_p->loop_params.c_t.count *= dlpChild_p->loop_params.c_t.count;
- dlpOld_p->el_size = dlpChild_p->el_size;
- dlpOld_p->el_extent = dlpChild_p->el_extent;
- dlpOld_p->el_type = dlpChild_p->el_type;
- dlpOld_p->kind |= DLOOP_FINAL_MASK;
- dlpOld_p->loop_params.c_t.dataloop = 0;
-#ifdef MPICH_DEBUG_DATALOOP
- if (printIfOptimized || printDataloop) {
- printf( "replacement contig is:\n" );
- dl_print_contig( level, dlpOld_p );
- }
-#endif
- }
- else {
- /* */
- /* printf( "not replacing...\n" ); */
- /* If the low level contig is a single byte,
- we could make that replacement. Not done. */
- /* By doing nothing here, we ensure that the dataloop
- is correct if not fully optimized */
- ;
- }
- }
- }
- break;
-
- case DLOOP_KIND_VECTOR:
- /* if sub-dloop is (non-basic) contig, merge with blockcount */
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- dl_print_vector( level, dlpOld_p );
-#endif
-
- if (!(dlpOld_p->kind & DLOOP_FINAL_MASK)) {
- DLOOP_Dataloop *dlpChild_p = dlpOld_p->loop_params.v_t.dataloop;
- PREPEND_PREFIX(Dataloop_optimize)( dlpChild_p, level+1 );
-
- if (dl_contig_isFinal( dlpChild_p ) &&
- !MPIU_Prod_overflows_max(
- dlpChild_p->loop_params.count,
- dlpOld_p->loop_params.v_t.blocksize,
- INT_MAX ) ) {
- /* We can replace the contig type by enlarging the blocksize */
- if (dlpOld_p->el_size == dlpOld_p->el_extent ||
- dlpOld_p->loop_params.v_t.blocksize == 1) {
- /* Reset the kind to final, free the child type,
- set to null */
- dlpOld_p->loop_params.v_t.blocksize *=
- dlpChild_p->loop_params.count;
- dlpOld_p->el_size = dlpChild_p->el_size;
- dlpOld_p->el_type = dlpChild_p->el_type;
- /*dlpOld_p->el_extent = dlpChild_p->el_extent; */
- dlpOld_p->kind |= DLOOP_FINAL_MASK;
- dlpOld_p->loop_params.v_t.dataloop = 0;
-#ifdef MPICH_DEBUG_DATALOOP
- if (printIfOptimized || printDataloop) {
- printf( "replacement Vector is:\n" );
- dl_print_vector( level, dlpOld_p );
- }
-#endif
- }
- else {
- /* TODO: If the vector elements do not have
- size==extent, and the blocksize is greater than 1,
- then it may be better to replace the elements with
- a single strided(vector) copy with blocksize elements:
- New vector:
- stride <- extent
- el_size <- size
- extent <- ?
- count <- blocksize
- blocksize <- 1
- Old vector become
- blocksize <- 1
- extent <- ?
- */
- dlpChild_p->loop_params.v_t.stride =
- dlpOld_p->el_extent;
- dlpChild_p->el_size = 1;
- dlpChild_p->el_type = MPI_BYTE;
- dlpChild_p->loop_params.v_t.dataloop = 0;
- dlpChild_p->loop_params.v_t.count =
- dlpOld_p->loop_params.v_t.blocksize;
- dlpChild_p->loop_params.v_t.blocksize = dlpOld_p->el_size;
- dlpChild_p->kind = DLOOP_KIND_VECTOR |
- DLOOP_FINAL_MASK;
- dlpOld_p->loop_params.v_t.blocksize = 1;
-#ifdef MPICH_DEBUG_DATALOOP
- if (printIfOptimized || printDataloop) {
- printf( "Replacing vector of contig with vector of vector\n" );
- printf( "replacement Vector is:\n" );
- dl_print_vector( level, dlpOld_p );
- dl_print_vector( level+1, dlpChild_p );
- }
-#endif
- }
- }
- }
- /* replace vector of a single element with contig */
- if ((dlpOld_p->kind & DLOOP_FINAL_MASK)) {
- int blocksize = dlpOld_p->loop_params.v_t.blocksize;
- int count = dlpOld_p->loop_params.v_t.count;
- if (dlpOld_p->el_size * blocksize ==
- dlpOld_p->loop_params.v_t.stride &&
- !MPIU_Prod_overflows_max( count, blocksize, INT_MAX ) ) {
- dlpOld_p->kind = DLOOP_KIND_CONTIG | DLOOP_FINAL_MASK;
- dlpOld_p->loop_params.c_t.dataloop = 0;
- dlpOld_p->loop_params.c_t.count = count * blocksize;
-#ifdef MPICH_DEBUG_DATALOOP
- if (printIfOptimized || printDataloop) {
- printf( "replacement Contig is:\n" );
- dl_print_contig( level, dlpOld_p );
- }
-#endif
- }
- }
- /* replace vector that is contiguous with contiguous */
- break;
-
- case DLOOP_KIND_BLOCKINDEXED:
- /* if subdloop is (non-basic) contig, merge with blockcount */
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- dl_print_blockindexed( level, dlpOld_p );
-#endif
- if (!(dlpOld_p->kind & DLOOP_FINAL_MASK)) {
- DLOOP_Dataloop *dlpChild_p = dlpOld_p->loop_params.bi_t.dataloop;
- PREPEND_PREFIX(Dataloop_optimize)( dlpChild_p, level+1 );
- if (dl_contig_isFinal( dlpChild_p ) &&
- !MPIU_Prod_overflows_max(
- dlpChild_p->loop_params.count,
- dlpOld_p->loop_params.bi_t.blocksize,
- INT_MAX ) ) {
- /* We can replace the contig type by enlarging the blocksize */
-
- /* Reset the kind to final, free the child type, set to null */
- dlpOld_p->loop_params.bi_t.blocksize *= dlpChild_p->loop_params.count;
- dlpOld_p->el_size = dlpChild_p->el_size;
- /*dlpOld_p->el_extent = dlpChild_p->el_extent;*/
- dlpOld_p->el_type = dlpChild_p->el_type;
- dlpOld_p->kind |= DLOOP_FINAL_MASK;
- dlpOld_p->loop_params.bi_t.dataloop = 0;
-#ifdef MPICH_DEBUG_DATALOOP
- if (printIfOptimized || printDataloop) {
- printf( "replacement BlockIndexed is:\n" );
- dl_print_blockindexed( level, dlpOld_p );
- }
-#endif
- }
- }
- break;
-
- case DLOOP_KIND_INDEXED:
- /* if sub-dloop is (non-basic) contig, merge with blockcount */
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- dl_print_indexed( level, dlpOld_p );
-#endif
- if (!(dlpOld_p->kind & DLOOP_FINAL_MASK)) {
- DLOOP_Dataloop *dlpChild_p = dlpOld_p->loop_params.i_t.dataloop;
- PREPEND_PREFIX(Dataloop_optimize)( dlpChild_p, level+1 );
- if (dl_contig_isFinal( dlpChild_p ) ) {
- /* Could include the child type in the blocksize counts */
- }
- }
-
- /* replace indexed of a single element with contig */
-
- /* If all block counts are multiples of the smallest, and if most
- blocks are smallest, then the other blocks could be split into
- separate blocks with appropriate offsets, replacing indexed with
- blockindexed */
-
- break;
-
- case DLOOP_KIND_STRUCT:
- /* if sub-dloops are all contig, replace with indexed */
- /* Not done yet - but first step is to recurse and
- simply/optimize the component dataloops */
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop) {
- dl_print_struct( level, dlpOld_p );
- printf( "now optimizing...\n" );
- }
-#endif
- if (!(dlpOld_p->kind & DLOOP_FINAL_MASK)) {
- for (i=0; i<dlpOld_p->loop_params.s_t.count; i++) {
- PREPEND_PREFIX(Dataloop_optimize)(
- dlpOld_p->loop_params.s_t.dataloop_array[i],
- level+1);
- }
- }
- /* Can the preceding if case ever be false? */
- /* Heres where we might check the following:
- Are all child dataloops CONTIG?
- Are all extents equal to sizes?
- Are all LBs equal to 0?
- If these are all true and in addition they are contiguous,
- replace with a single contig (but be careful of the extent)
- Otherwise, if these are all true, then replace with INDEXED.
- */
- if (!(dlpOld_p->kind & DLOOP_FINAL_MASK)) {
- int isContig = 1;
- int allContig = 1;
- MPI_Aint lastAdd = 0;
- for (i=0; i<dlpOld_p->loop_params.s_t.count; i++) {
- DLOOP_Dataloop *dlpChild_p =
- dlpOld_p->loop_params.s_t.dataloop_array[i];
- if ((dlpChild_p->kind & DLOOP_KIND_MASK) != DLOOP_KIND_CONTIG) {
- allContig = 0; break;
- }
- if (/* dlpChild_p->el_lb != 0 || */ /* No lb in dataloop(?) */
- dlpChild_p->el_extent != dlpChild_p->el_size) {
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- printf( "not natural contig\n" );
-#endif
- allContig = 0; break;
- }
- if (isContig &&
- lastAdd != dlpOld_p->loop_params.s_t.offset_array[i]) {
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- printf( "Not contiguous bytes: %lx != %lx\n",
- (long)lastAdd,
- (long)dlpOld_p->loop_params.s_t.offset_array[i] );
-#endif
- isContig = 0;
- }
- else {
- lastAdd += dlpChild_p->el_extent *
- dlpChild_p->loop_params.count;
- }
- }
- if (allContig) {
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- printf( "All subtypes are contig - can replace with index\n" );
-#endif
- if (isContig) {
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- printf( "All subtypes consequtive - can replace with a single contig\n" );
-#endif
- ;
- }
- }
- }
-
- break;
- default:
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop)
- dl_print( level, "Unknown type!" );
-#endif
- break;
- }
-
-#ifdef MPICH_DEBUG_DATALOOP
- if (printDataloop && level == 0)
- printf( "Done!\n" );
-#endif
-
- return 0;
-}
-
-
-/*
- * Make an estimate at the complexity of a datatype. This can be used
- * to determine whether flattening the datatype to an indexed type is
- * likely to be efficient.
- */
-int PREPEND_PREFIX(Dataloop_est_complexity)(DLOOP_Dataloop *dlp_p,
- MPI_Aint *nElms,
- MPI_Aint *nDesc )
-{
- int i;
- MPI_Aint myElms = 0;
- MPI_Aint myDesc = 0;
- MPI_Aint childElms = 0, childDesc = 0;
- DLOOP_Dataloop *dlpChild_p;
-
- switch (dlp_p->kind & DLOOP_KIND_MASK) {
- case DLOOP_KIND_CONTIG:
- /* Data moved is count*size of the child type */
-
- if (!(dlp_p->kind & DLOOP_FINAL_MASK)) {
- dlpChild_p = dlp_p->loop_params.c_t.dataloop;
- PREPEND_PREFIX(Dataloop_est_complexity)( dlpChild_p, &childElms,
- &childDesc );
- }
- else {
- childElms = dlp_p->el_size;
- childDesc = 0;
- }
- myElms += dlp_p->loop_params.c_t.count * childElms;
- myDesc += childDesc + 1;
-
- break;
-
- case DLOOP_KIND_VECTOR:
- /* Data moved is count*size of the child type */
-
- if (!(dlp_p->kind & DLOOP_FINAL_MASK)) {
- dlpChild_p = dlp_p->loop_params.v_t.dataloop;
- PREPEND_PREFIX(Dataloop_est_complexity)( dlpChild_p, &childElms,
- &childDesc );
- }
- else {
- childElms = dlp_p->el_size;
- childDesc = 0;
- }
- myElms += dlp_p->loop_params.v_t.count *
- dlp_p->loop_params.v_t.blocksize * childElms;
- myDesc += childDesc + 2;
-
- break;
-
- case DLOOP_KIND_BLOCKINDEXED:
- if (!(dlp_p->kind & DLOOP_FINAL_MASK)) {
- dlpChild_p = dlp_p->loop_params.bi_t.dataloop;
- PREPEND_PREFIX(Dataloop_est_complexity)( dlpChild_p, &childElms,
- &childDesc );
- }
- else {
- childElms = dlp_p->el_size;
- childDesc = 0;
- }
- myElms += dlp_p->loop_params.bi_t.count *
- dlp_p->loop_params.bi_t.blocksize * childElms;
- myDesc += childDesc + dlp_p->loop_params.bi_t.count;
- break;
-
- case DLOOP_KIND_INDEXED:
-
- if (!(dlp_p->kind & DLOOP_FINAL_MASK)) {
- dlpChild_p = dlp_p->loop_params.i_t.dataloop;
- PREPEND_PREFIX(Dataloop_est_complexity)( dlpChild_p, &childElms,
- &childDesc );
- }
- else {
- childElms = dlp_p->el_size;
- childDesc = 0;
- }
- myElms += dlp_p->loop_params.i_t.total_blocks * childElms;
- myDesc += childDesc + 2 * dlp_p->loop_params.i_t.count;
-
- break;
-
- case DLOOP_KIND_STRUCT:
- if (!(dlp_p->kind & DLOOP_FINAL_MASK)) {
- MPI_Aint celm, cdesc;
- for (i=0; i<dlp_p->loop_params.s_t.count; i++) {
- celm = 0; cdesc = 0;
- PREPEND_PREFIX(Dataloop_est_complexity)(
- dlp_p->loop_params.s_t.dataloop_array[i],
- &celm, &cdesc );
- childElms += celm * dlp_p->loop_params.s_t.blocksize_array[i];
- childDesc += cdesc + 3;
- }
- }
- else {
- int elsize = dlp_p->el_size;
- childElms = 0;
- childDesc = 0;
- for (i=0; i<dlp_p->loop_params.s_t.count; i++) {
- childElms += elsize * dlp_p->loop_params.s_t.blocksize_array[i];
- childDesc += 3;
- }
- }
-
- myElms += childElms;
- myDesc += childDesc;
- break;
-
- default:
- break;
- }
-
- /* Return the final values */
- *nElms += myElms;
- *nDesc += myDesc;
-
- return 0;
-}
-
-/*
- * Estimate the complexity of a struct Dataloop before it is constructed.
- */
-int PREPEND_PREFIX(Dataloop_est_struct_complexity)( int count,
- const int blklens[],
- const DLOOP_Type oldtypes[],
- MPI_Aint *nElms,
- MPI_Aint *nDesc )
-{
- MPI_Aint myElms = 0, myDesc = 0;
- int i;
- int flag = MPID_DATALOOP_ALL_BYTES;
-
- for (i=0; i<count; i++) {
- DLOOP_Dataloop *dlp_p = 0;
- MPI_Aint celms = 0, cdesc = 0;
-
- DLOOP_Handle_get_loopptr_macro(oldtypes[i],dlp_p,flag);
- if (dlp_p) {
- PREPEND_PREFIX(Dataloop_est_complexity)( dlp_p,
- &celms, &cdesc );
- }
- else {
- celms = 1;
- cdesc = 1;
- }
- myElms += celms * blklens[i];
- myDesc += cdesc;
- }
- *nElms = myElms;
- *nDesc = myDesc;
-
- return MPI_SUCCESS;
-}
diff --git a/src/mpid/common/datatype/dataloop/segment_packunpack.c b/src/mpid/common/datatype/dataloop/segment_packunpack.c
index 1712f38..7a2ea88 100644
--- a/src/mpid/common/datatype/dataloop/segment_packunpack.c
+++ b/src/mpid/common/datatype/dataloop/segment_packunpack.c
@@ -13,8 +13,6 @@
#include "dataloop.h"
#include "veccpy.h"
-/* NOTE: bufp values are unused, ripe for removal */
-
/* #define MPICH_DEBUG_SEGMENT_MOVE */
/* TODO: Consider integrating this with the general debug support. */
/* Note: This does not use the CVAR support for the environment variable
@@ -37,6 +35,8 @@ static void setPrint( void ) {
#define DBG_SEGMENT(_a)
#endif
+/* NOTE: bufp values are unused, ripe for removal */
+
int PREPEND_PREFIX(Segment_contig_m2m)(DLOOP_Offset *blocks_p,
DLOOP_Type el_type,
DLOOP_Offset rel_off,
@@ -323,22 +323,6 @@ int PREPEND_PREFIX(Segment_blkidx_m2m)(DLOOP_Offset *blocks_p,
DLOOP_Handle_get_size_macro(el_type, el_size);
DBG_SEGMENT(printf( "blkidx m2m: elsize = %d, count = %d, blocklen = %d\n", (int)el_size, (int)count, (int)blocklen ));
- /* If the blocklen * el_size is relatively small, then for
- performance reasons, its important to hoist most of these
- tests out of the loop. Ignoring some of the issues of handling
- the available buffer size (blocks_left), this should translate
- directly into code that looks like this for blocksize == 1
-
- for (i=0; i<count; i++) {
- dest[i] = userbuf[offsetarray[i]];
- }
-
- where "dest" and "userbuf" are pointers to objects of the correct
- size. If blocksize is > 1, then various unrollings are important
- until blocksize is large enough to make the overhead of memcpy
- negligible. Datatypes such as this are used in LAMMPS, for example.
- */
-
while (blocks_left) {
char *src, *dest;
diff --git a/src/mpid/common/datatype/mpid_type_commit.c b/src/mpid/common/datatype/mpid_type_commit.c
index b27eaff..d990503 100644
--- a/src/mpid/common/datatype/mpid_type_commit.c
+++ b/src/mpid/common/datatype/mpid_type_commit.c
@@ -58,17 +58,6 @@ int MPID_Type_commit(MPI_Datatype *datatype_p)
MPIU_DBG_PRINTF(("# contig blocks = %d\n",
(int) datatype_ptr->max_contig_blocks));
- if (MPIR_CVAR_DATALOOP_OPTIMIZE) {
- MPID_Dataloop_optimize(datatype_ptr->dataloop, 0 );
- }
- else {
- /* This allows the developer to output the final dataloops
- in the case where the dataloops are not optimized.
- It does nothing if that printing is not enabled.
- */
- MPID_Dataloop_debug_print( datatype_ptr->dataloop );
- }
-
#if 0
MPIDI_Dataloop_dot_printf(datatype_ptr->dataloop, 0, 1);
#endif
diff --git a/test/mpi/datatype/testlist.in b/test/mpi/datatype/testlist.in
index 3f7d07a..b2875b2 100644
--- a/test/mpi/datatype/testlist.in
+++ b/test/mpi/datatype/testlist.in
@@ -59,4 +59,4 @@ cxx-types 1 mpiversion=3.0
@largetest@large_type 1 mpiversion=3.0
@largetest@large_type_sendrec 2 arg=31 mpiversion=3.0
@largetest@large_type_sendrec 2 arg=32 mpiversion=3.0 timeLimit=360
-get-struct 2 xfail=ticket2115
+get-struct 2
-----------------------------------------------------------------------
Summary of changes:
src/mpid/common/datatype/dataloop/Makefile.mk | 3 +-
.../common/datatype/dataloop/dataloop_create.h | 13 +-
.../datatype/dataloop/dataloop_create_struct.c | 93 +---
.../common/datatype/dataloop/dataloop_optimize.c | 668 --------------------
.../common/datatype/dataloop/segment_packunpack.c | 20 +-
src/mpid/common/datatype/mpid_type_commit.c | 11 -
test/mpi/datatype/testlist.in | 2 +-
7 files changed, 17 insertions(+), 793 deletions(-)
delete mode 100644 src/mpid/common/datatype/dataloop/dataloop_optimize.c
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-104-g7669873
by noreply@mpich.org 15 Jul '14
by noreply@mpich.org 15 Jul '14
15 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 7669873d2dadd04dd8509aa5939d68f24eef4c32 (commit)
from 8eef807cf5a6a61b8d6a1289f52d900afe779c10 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/7669873d2dadd04dd8509aa5939d68f24…
commit 7669873d2dadd04dd8509aa5939d68f24eef4c32
Author: Ken Raffenetti <raffenet(a)mcs.anl.gov>
Date: Tue Jul 15 14:41:11 2014 -0500
fixup issendselfcancel test
Incorrect preprocessor directives caused when porting Python code to C.
Signed-off-by: Wesley Bland <wbland(a)anl.gov>
diff --git a/test/mpi/pt2pt/issendselfcancel.c b/test/mpi/pt2pt/issendselfcancel.c
index c5ee541..20adb4b 100644
--- a/test/mpi/pt2pt/issendselfcancel.c
+++ b/test/mpi/pt2pt/issendselfcancel.c
@@ -3,10 +3,10 @@
* (C) 2014 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
-#import <stdio.h>
-#import <stdlib.h>
-#import <assert.h>
-#import "mpi.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "mpi.h"
int main(int argc, char **argv)
{
-----------------------------------------------------------------------
Summary of changes:
test/mpi/pt2pt/issendselfcancel.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-103-g8eef807
by noreply@mpich.org 15 Jul '14
by noreply@mpich.org 15 Jul '14
15 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 8eef807cf5a6a61b8d6a1289f52d900afe779c10 (commit)
via 209a8b7d1bc971339ae362f06ee49a9cc9150e43 (commit)
from aaf1d96f019f1ccfbcebfd17f6c5d098a3883a4f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/8eef807cf5a6a61b8d6a1289f52d900af…
commit 8eef807cf5a6a61b8d6a1289f52d900afe779c10
Author: Wesley Bland <wbland(a)anl.gov>
Date: Thu Jul 10 16:41:34 2014 -0500
Add a test for the bug in #2129
Test this case so we don't have another regression. Thanks for test case
contributed by Lisandro Dalcin (dalcinl(a)gmail.com)
See #2129
Signed-off-by: Ken Raffenetti <raffenet(a)mcs.anl.gov>
diff --git a/test/mpi/pt2pt/Makefile.am b/test/mpi/pt2pt/Makefile.am
index 4929daa..752a451 100644
--- a/test/mpi/pt2pt/Makefile.am
+++ b/test/mpi/pt2pt/Makefile.am
@@ -23,6 +23,7 @@ noinst_PROGRAMS = \
bsendalign \
cancelrecv \
isendself \
+ issendselfcancel \
sendself \
eagerdt \
isendselfprobe \
diff --git a/test/mpi/pt2pt/issendselfcancel.c b/test/mpi/pt2pt/issendselfcancel.c
new file mode 100644
index 0000000..c5ee541
--- /dev/null
+++ b/test/mpi/pt2pt/issendselfcancel.c
@@ -0,0 +1,36 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ * (C) 2014 by Argonne National Laboratory.
+ * See COPYRIGHT in top-level directory.
+ */
+#import <stdio.h>
+#import <stdlib.h>
+#import <assert.h>
+#import "mpi.h"
+
+int main(int argc, char **argv)
+{
+ MPI_Request req;
+ MPI_Status status;
+
+ MPI_Init(NULL, NULL);
+
+ MPI_Issend(NULL, 0, MPI_BYTE, 0, 123, MPI_COMM_SELF, &req);
+
+ MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_SELF, &status);
+ assert(status.MPI_SOURCE == 0);
+ assert(status.MPI_TAG == 123);
+
+ MPI_Cancel(&req);
+ assert(req != MPI_REQUEST_NULL);
+
+ MPI_Request_free(&req);
+
+ MPI_Irecv(NULL, 0, MPI_BYTE, 0, 123, MPI_COMM_SELF, &req);
+ MPI_Cancel(&req);
+ MPI_Wait(&req, &status);
+
+ printf(" No Errors\n");
+
+ MPI_Finalize();
+}
diff --git a/test/mpi/pt2pt/testlist b/test/mpi/pt2pt/testlist
index 89de3e2..d3a7da9 100644
--- a/test/mpi/pt2pt/testlist
+++ b/test/mpi/pt2pt/testlist
@@ -16,6 +16,7 @@ bsend5 4
bsendalign 2
bsendpending 2
isendself 1
+issendselfcancel 1
bsendfrag 2
icsend 4
rqstatus 2
http://git.mpich.org/mpich.git/commitdiff/209a8b7d1bc971339ae362f06ee49a9cc…
commit 209a8b7d1bc971339ae362f06ee49a9cc9150e43
Author: Wesley Bland <wbland(a)anl.gov>
Date: Thu Jul 10 16:25:30 2014 -0500
Fix refcounting for isends
The refcounting for isends needs to be reset to 0 sometimes if an error occurs
before passing the request back to the user. This was mistakenly cleaned up in
[1e171ff6] and now needs to be set back (along with a better comment
explaining the problem.
Thanks for the bug report to Lisandro Dalcin (dalcinl(a)gmail.com)
Fixes #2129
Signed-off-by: Ken Raffenetti <raffenet(a)mcs.anl.gov>
diff --git a/src/mpid/ch3/src/mpid_cancel_send.c b/src/mpid/ch3/src/mpid_cancel_send.c
index 9610793..4772c8c 100644
--- a/src/mpid/ch3/src/mpid_cancel_send.c
+++ b/src/mpid/ch3/src/mpid_cancel_send.c
@@ -66,9 +66,12 @@ int MPID_Cancel_send(MPID_Request * sreq)
MPIU_DBG_MSG_FMT(CH3_OTHER,VERBOSE,(MPIU_DBG_FDEST,
"send-to-self cancellation successful, sreq=0x%08x, rreq=0x%08x",
sreq->handle, rreq->handle));
-
- MPID_Request_release(rreq);
-
+
+ /* Pull the message out of the unexpected queue since it's being
+ * cancelled */
+ MPIU_Object_set_ref(rreq, 0);
+ MPIDI_CH3_Request_destroy(rreq);
+
MPIR_STATUS_SET_CANCEL_BIT(sreq->status, TRUE);
/* no other thread should be waiting on sreq, so it is safe to
reset ref_count and cc */
diff --git a/src/mpid/ch3/src/mpidi_isend_self.c b/src/mpid/ch3/src/mpidi_isend_self.c
index 3d71199..2961a07 100644
--- a/src/mpid/ch3/src/mpidi_isend_self.c
+++ b/src/mpid/ch3/src/mpidi_isend_self.c
@@ -45,7 +45,10 @@ int MPIDI_Isend_self(const void * buf, int count, MPI_Datatype datatype, int ran
/* --BEGIN ERROR HANDLING-- */
if (rreq == NULL)
{
- MPID_Request_release(sreq);
+ /* Set the refcount to 0 since the user will never have a chance to
+ * release their reference */
+ MPIU_Object_set_ref(sreq, 0);
+ MPIDI_CH3_Request_destroy(sreq);
sreq = NULL;
MPIU_ERR_SET1(mpi_errno, MPI_ERR_OTHER, "**nomem",
"**nomemuereq %d", MPIDI_CH3U_Recvq_count_unexp());
-----------------------------------------------------------------------
Summary of changes:
src/mpid/ch3/src/mpid_cancel_send.c | 9 +++++--
src/mpid/ch3/src/mpidi_isend_self.c | 5 +++-
test/mpi/pt2pt/Makefile.am | 1 +
test/mpi/pt2pt/issendselfcancel.c | 36 +++++++++++++++++++++++++++++++++++
test/mpi/pt2pt/testlist | 1 +
5 files changed, 48 insertions(+), 4 deletions(-)
create mode 100644 test/mpi/pt2pt/issendselfcancel.c
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-101-gaaf1d96
by noreply@mpich.org 14 Jul '14
by noreply@mpich.org 14 Jul '14
14 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via aaf1d96f019f1ccfbcebfd17f6c5d098a3883a4f (commit)
from 76f4c56e8ee67010a816291c9d45ccc745960a1e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/aaf1d96f019f1ccfbcebfd17f6c5d098a…
commit aaf1d96f019f1ccfbcebfd17f6c5d098a3883a4f
Author: Pavan Balaji <balaji(a)anl.gov>
Date: Mon Jul 14 16:19:43 2014 -0500
Mark get-struct as an xfail.
Signed-off-by: Ken Raffenetti <raffenet(a)mcs.anl.gov>
diff --git a/test/mpi/datatype/testlist.in b/test/mpi/datatype/testlist.in
index b2875b2..3f7d07a 100644
--- a/test/mpi/datatype/testlist.in
+++ b/test/mpi/datatype/testlist.in
@@ -59,4 +59,4 @@ cxx-types 1 mpiversion=3.0
@largetest@large_type 1 mpiversion=3.0
@largetest@large_type_sendrec 2 arg=31 mpiversion=3.0
@largetest@large_type_sendrec 2 arg=32 mpiversion=3.0 timeLimit=360
-get-struct 2
+get-struct 2 xfail=ticket2115
-----------------------------------------------------------------------
Summary of changes:
test/mpi/datatype/testlist.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0
[mpich] MPICH primary repository branch, master, updated. v3.1.1-100-g76f4c56
by noreply@mpich.org 14 Jul '14
by noreply@mpich.org 14 Jul '14
14 Jul '14
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".
The branch, master has been updated
via 76f4c56e8ee67010a816291c9d45ccc745960a1e (commit)
via 4efc8b2e54965ba79e634b6c93f91d7669644805 (commit)
via 998a8a0bd9747847e37b03c9976bff4476d28324 (commit)
via 1b016bb2d7463eb884e1a9dc478fd596b7303743 (commit)
from 299bfd406a68b22ee0b14a10f60780d5acf30129 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/76f4c56e8ee67010a816291c9d45ccc74…
commit 76f4c56e8ee67010a816291c9d45ccc745960a1e
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Mon Jul 14 12:46:05 2014 -0500
Increase buffer size to cover longer cvar strings
Signed-off-by: Sangmin Seo <sseo(a)anl.gov>
diff --git a/src/env/mpivars.c b/src/env/mpivars.c
index 772f8f5..080aedd 100644
--- a/src/env/mpivars.c
+++ b/src/env/mpivars.c
@@ -112,7 +112,7 @@ int PrintControlVars( FILE *fp )
{
int i, num_cvar, nameLen, verbosity, descLen, binding, scope;
int hasValue;
- char name[MAX_NAME_LEN], desc[MAX_DESC_LEN], varValue[21];
+ char name[MAX_NAME_LEN], desc[MAX_DESC_LEN], varValue[512];
MPI_T_enum enumtype;
MPI_Datatype datatype;
@@ -166,7 +166,7 @@ int PrintPerfVars( FILE *fp )
{
int i, numPvar, nameLen, descLen, verbosity, varClass;
int binding, isReadonly, isContinuous, isAtomic;
- char name[MAX_NAME_LEN], desc[MAX_DESC_LEN], varValue[21];
+ char name[MAX_NAME_LEN], desc[MAX_DESC_LEN], varValue[512];
MPI_T_enum enumtype;
MPI_Datatype datatype;
http://git.mpich.org/mpich.git/commitdiff/4efc8b2e54965ba79e634b6c93f91d766…
commit 4efc8b2e54965ba79e634b6c93f91d7669644805
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Mon Jul 14 10:56:12 2014 -0500
Allocate mem. for a cvar when its type is MPI_CHAR
https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/405 says :
"The use of the datatype MPI_CHAR in the MPI tool information interface implies a
null-terminated character array, i.e. a string in the C language. If a variable has
type MPI_CHAR, the value of the count parameter returned by MPI_T_CVAR_HANDLE_ALLOC
and MPI_T_PVAR_HANDLE_ALLOC will include the null-terminating character."
Unlike cvars of type MPI_INT etc, MPI_CHAR cvars need explicit memory allocation for their storage.
Note: In MPI standard, MPI_CHAR is not in types of pvar.
Fixes #2021
Signed-off-by: Sangmin Seo <sseo(a)anl.gov>
diff --git a/src/mpi_t/mpit.c b/src/mpi_t/mpit.c
index 62f602c..d25ec93 100644
--- a/src/mpi_t/mpit.c
+++ b/src/mpi_t/mpit.c
@@ -315,7 +315,19 @@ void MPIR_T_CVAR_REGISTER_impl(
cvar->datatype = dtype;
cvar->name = MPIU_Strdup(name);
MPIU_Assert(cvar->name);
- cvar->addr = (void *)addr;
+ if (dtype != MPI_CHAR) {
+ cvar->addr = (void *)addr;
+ } else {
+ cvar->addr = MPIU_Malloc(count);
+ MPIU_Assert(cvar->addr);
+ if (defaultval.str == NULL) {
+ ((char *)(cvar->addr))[0] = '\0';
+ } else {
+ /* Use greater (>), since count includes the terminating '\0', but strlen does not */
+ MPIU_Assert(count > strlen(defaultval.str));
+ strcpy(cvar->addr, defaultval.str);
+ }
+ }
cvar->count = count;
cvar->verbosity = verb;
cvar->bind = binding;
diff --git a/src/mpi_t/mpit_finalize.c b/src/mpi_t/mpit_finalize.c
index 5e2e1aa..5ef7a9e 100644
--- a/src/mpi_t/mpit_finalize.c
+++ b/src/mpi_t/mpit_finalize.c
@@ -102,6 +102,7 @@ static void MPIR_T_cvar_env_finalize(void)
cvar = (cvar_table_entry_t *)utarray_eltptr(cvar_table, i);
MPIU_Free((void *)cvar->name);
MPIU_Free((void *)cvar->desc);
+ if (cvar->datatype == MPI_CHAR) MPIU_Free(cvar->addr);
}
/* Free pvar_table itself */
http://git.mpich.org/mpich.git/commitdiff/998a8a0bd9747847e37b03c9976bff447…
commit 998a8a0bd9747847e37b03c9976bff4476d28324
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Mon Jul 14 10:51:47 2014 -0500
Added assertion to protect cvars of type MPI_CHAR
Make sure user buf wont overflow cvar which is a string
Signed-off-by: Sangmin Seo <sseo(a)anl.gov>
diff --git a/src/mpi_t/cvar_write.c b/src/mpi_t/cvar_write.c
index 519f11f..b88959e 100644
--- a/src/mpi_t/cvar_write.c
+++ b/src/mpi_t/cvar_write.c
@@ -71,6 +71,7 @@ int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, void *buf)
((double *)addr)[i] = ((double *)buf)[i];
break;
case MPI_CHAR:
+ MPIU_Assert(count > strlen(buf)); /* Make sure buf will not overflow this cvar */
MPIU_Strncpy(addr, buf, count);
break;
default:
http://git.mpich.org/mpich.git/commitdiff/1b016bb2d7463eb884e1a9dc478fd596b…
commit 1b016bb2d7463eb884e1a9dc478fd596b7303743
Author: Junchao Zhang <jczhang(a)mcs.anl.gov>
Date: Mon Jul 14 10:43:22 2014 -0500
Set MPIR_CVAR_MAX_STRLEN to a smaller value
The old value (4096) was arbitrarily chosen. To save memory and to make cvar
tests cover the MPI_CHAR case easily, we set it to a smaller value, which is
still big enough to hold reasonable cvar strings.
Signed-off-by: Sangmin Seo <sseo(a)anl.gov>
diff --git a/maint/extractcvars.in b/maint/extractcvars.in
index e95e393..bb2eca3 100755
--- a/maint/extractcvars.in
+++ b/maint/extractcvars.in
@@ -173,7 +173,7 @@ print OUTPUT_H <<EOT;
#define ${ns}_assert MPIU_Assert
/* Arbitrary, simplifies interaction with external interfaces like MPI_T_ */
-#define ${uc_ns}_MAX_STRLEN (4096)
+#define ${uc_ns}_MAX_STRLEN (384)
#endif /* $hdr_guard */
EOT
-----------------------------------------------------------------------
Summary of changes:
maint/extractcvars.in | 2 +-
src/env/mpivars.c | 4 ++--
src/mpi_t/cvar_write.c | 1 +
src/mpi_t/mpit.c | 14 +++++++++++++-
src/mpi_t/mpit_finalize.c | 1 +
5 files changed, 18 insertions(+), 4 deletions(-)
hooks/post-receive
--
MPICH primary repository
1
0