Commit ef5adb76 authored by Misbah Mubarak's avatar Misbah Mubarak

Merge branch 'cortex' into 'master'

Cortex

Integration of Cortex in CODES. Cortex can be enabled with --with-cortex=... when configuring CODES. When Cortex is enabled, it will be used in place of DUMPI and automatically translate MPI collectives using algorithms as implemented in Mpich.

This merge request also adds support for MPI_Sendrecv in the MPI replayer, and corrects an issue with CODES expecting the size of a posted MPI_Recv to match with the corresponding MPI_Send's size, which is not a requirement in the MPI standard.

See merge request !14
parents e9ad2621 fd5d8ad2
...@@ -39,6 +39,12 @@ include $(top_srcdir)/src/Makefile.subdir ...@@ -39,6 +39,12 @@ include $(top_srcdir)/src/Makefile.subdir
include $(top_srcdir)/tests/Makefile.subdir include $(top_srcdir)/tests/Makefile.subdir
include $(top_srcdir)/doc/Makefile.subdir include $(top_srcdir)/doc/Makefile.subdir
if USE_DEBUG
AM_CPPFLAGS += -g
AM_CFLAGS += -g
AM_CXXFLAGS += -g
endif
if USE_DARSHAN if USE_DARSHAN
AM_CPPFLAGS += ${DARSHAN_CFLAGS} -DUSE_DARSHAN=1 AM_CPPFLAGS += ${DARSHAN_CFLAGS} -DUSE_DARSHAN=1
src_libcodes_la_SOURCES += src/workload/methods/codes-darshan-io-wrkld.c src_libcodes_la_SOURCES += src/workload/methods/codes-darshan-io-wrkld.c
...@@ -55,4 +61,17 @@ if USE_DUMPI ...@@ -55,4 +61,17 @@ if USE_DUMPI
AM_CPPFLAGS += ${DUMPI_CFLAGS} -DUSE_DUMPI=1 AM_CPPFLAGS += ${DUMPI_CFLAGS} -DUSE_DUMPI=1
src_libcodes_la_SOURCES += src/workload/methods/codes-dumpi-trace-nw-wrkld.c src_libcodes_la_SOURCES += src/workload/methods/codes-dumpi-trace-nw-wrkld.c
LDADD += ${DUMPI_LIBS} LDADD += ${DUMPI_LIBS}
if USE_CORTEX
if USE_PYTHON
if USE_CORTEX_PYTHON
AM_CPPFLAGS += ${CORTEX_PYTHON_CFLAGS} -DENABLE_CORTEX_PYTHON=1
LDADD += ${CORTEX_PYTHON_LIBS}
AM_CPPFLAGS += ${PYTHON_CFLAGS}
LDADD += ${PYTHON_LIBS}
endif
endif endif
AM_CPPFLAGS += ${CORTEX_CFLAGS} -DENABLE_CORTEX=1
LDADD += ${CORTEX_LIBS}
endif
endif
...@@ -69,6 +69,10 @@ struct recorder_params ...@@ -69,6 +69,10 @@ struct recorder_params
struct dumpi_trace_params { struct dumpi_trace_params {
char file_name[MAX_NAME_LENGTH_WKLD]; char file_name[MAX_NAME_LENGTH_WKLD];
int num_net_traces; int num_net_traces;
#ifdef ENABLE_CORTEX_PYTHON
char cortex_script[MAX_NAME_LENGTH_WKLD];
char cortex_class[MAX_NAME_LENGTH_WKLD];
#endif
}; };
struct checkpoint_wrkld_params struct checkpoint_wrkld_params
......
...@@ -84,6 +84,12 @@ AC_TRY_COMPILE([#include <mpi.h>], [int ret = MPI_Init(0, (void*)0)], ...@@ -84,6 +84,12 @@ AC_TRY_COMPILE([#include <mpi.h>], [int ret = MPI_Init(0, (void*)0)],
PKG_CHECK_MODULES_STATIC([ROSS], [ross], [], PKG_CHECK_MODULES_STATIC([ROSS], [ross], [],
[AC_MSG_ERROR([Could not find working ross installation via pkg-config])]) [AC_MSG_ERROR([Could not find working ross installation via pkg-config])])
# check for enable-g
AC_ARG_ENABLE([g],[AS_HELP_STRING([--enable-g],
[Build with GDB symbols])],
[use_debug=yes],[use_debug=no])
AM_CONDITIONAL(USE_DEBUG, [test "x${use_debug}" = xyes])
# check for Darshan # check for Darshan
AC_ARG_WITH([darshan],[AS_HELP_STRING([--with-darshan], AC_ARG_WITH([darshan],[AS_HELP_STRING([--with-darshan],
[Build with the darshan workload support])], [Build with the darshan workload support])],
...@@ -121,6 +127,54 @@ else ...@@ -121,6 +127,54 @@ else
AM_CONDITIONAL(USE_DUMPI, false) AM_CONDITIONAL(USE_DUMPI, false)
fi fi
# check for Cortex
AC_ARG_WITH([cortex],[AS_HELP_STRING([--with-cortex@<:@=DIR@:>@],
[location of Cortex installation])])
# check for Python
AC_ARG_WITH([python],[AS_HELP_STRING([--with-python@<:@=DIR@:>@],
[location of Python 2.7 installation])])
# check for Boost Python
AC_ARG_WITH([boost],[AS_HELP_STRING([--with-boost@<:@=DIR@:>@],
[location of Boost Python installation])])
if [ test "x${with_python}" != "x" -a "x${with_boost}" != "x"] ; then
AC_CHECK_FILES([${with_python}/lib/libpython2.7.a ${with_boost}/lib/libboost_python.a],
AM_CONDITIONAL(USE_PYTHON, true),
AC_MSG_ERROR(Could not find Python and/or Boost-Python libraries))
PYTHON_CFLAGS="-I${with_python}/include -I${with_boost}/include"
PYTHON_LIBS="-L${with_boost}/lib -lboost_python -L${with_python}/lib/ -lpython2.7"
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_CFLAGS)
else
AM_CONDITIONAL(USE_PYTHON, false)
fi
if test "x${with_cortex}" != "x" ; then
AC_CHECK_FILES([${with_cortex}/lib/libcortex.a ${with_cortex}/lib/libcortex-mpich.a],
AM_CONDITIONAL(USE_CORTEX, true),
AC_MSG_ERROR(Could not find Cortex libraries libcortex.a and/or libcortex-mpich.a))
CORTEX_CFLAGS="-I${with_cortex}/include"
CORTEX_LIBS="-L${with_cortex}/lib/ -lcortex-mpich -lcortex -lstdc++"
AC_SUBST(CORTEX_LIBS)
AC_SUBST(CORTEX_CFLAGS)
else
AM_CONDITIONAL(USE_CORTEX, false)
fi
if [ test "x${with_cortex}" != "x" -a "x${with_python}" != "x" -a "x${with_boost}" != "x"] ; then
AC_CHECK_FILE([${with_cortex}/lib/libcortex-python.a],
AM_CONDITIONAL(USE_CORTEX_PYTHON, true),
AC_MSG_ERROR(Could not find library libcortex-python.a))
CORTEX_PYTHON_CFLAGS="-I${with_cortex}/include"
CORTEX_PYTHON_LIBS="-L${with_cortex}/lib/ -lcortex-python"
AC_SUBST(CORTEX_PYTHON_LIBS)
AC_SUBST(CORTEX_PYTHON_CFLAGS)
else
AM_CONDITIONAL(USE_CORTEX_PYTHON, false)
fi
dnl ====================================================================== dnl ======================================================================
dnl Try harder to be valgrind safe dnl Try harder to be valgrind safe
dnl ====================================================================== dnl ======================================================================
......
...@@ -8,11 +8,17 @@ darshan_libs=@DARSHAN_LIBS@ ...@@ -8,11 +8,17 @@ darshan_libs=@DARSHAN_LIBS@
darshan_cflags=@DARSHAN_CFLAGS@ darshan_cflags=@DARSHAN_CFLAGS@
dumpi_cflags=@DUMPI_CFLAGS@ dumpi_cflags=@DUMPI_CFLAGS@
dumpi_libs=@DUMPI_LIBS@ dumpi_libs=@DUMPI_LIBS@
cortex_cflags=@CORTEX_CFLAGS@
cortex_libs=@CORTEX_LIBS@
python_cflags=@PYTHON_CFLAGS@
python_libs=@PYTHON_LIBS@
boost_cflags=@BOOST_CFLAGS@
boost_libs=@BOOST_LIBS@
Name: codes-base Name: codes-base
Description: Base functionality for CODES storage simulation Description: Base functionality for CODES storage simulation
Version: @PACKAGE_VERSION@ Version: @PACKAGE_VERSION@
URL: http://trac.mcs.anl.gov/projects/CODES URL: http://trac.mcs.anl.gov/projects/CODES
Requires: Requires:
Libs: -L${libdir} -lcodes ${ross_libs} ${darshan_libs} ${dumpi_libs} Libs: -L${libdir} -lcodes ${ross_libs} ${darshan_libs} ${dumpi_libs} ${cortex_libs}
Cflags: -I${includedir} ${ross_cflags} ${darshan_cflags} ${dumpi_cflags} Cflags: -I${includedir} ${ross_cflags} ${darshan_cflags} ${dumpi_cflags} ${cortex_cflags}
...@@ -51,6 +51,14 @@ struct codes_jobmap_ctx *jobmap_ctx; ...@@ -51,6 +51,14 @@ struct codes_jobmap_ctx *jobmap_ctx;
struct codes_jobmap_params_list jobmap_p; struct codes_jobmap_params_list jobmap_p;
/* Xu's additions end */ /* Xu's additions end */
/* Variables for Cortex Support */
/* Matthieu's additions start */
#ifdef ENABLE_CORTEX_PYTHON
static char cortex_file[512];
static char cortex_class[512];
#endif
/* Matthieu's additions end */
typedef struct nw_state nw_state; typedef struct nw_state nw_state;
typedef struct nw_message nw_message; typedef struct nw_message nw_message;
typedef int32_t dumpi_req_id; typedef int32_t dumpi_req_id;
...@@ -635,10 +643,12 @@ static int rm_matching_send(nw_state * ns, ...@@ -635,10 +643,12 @@ static int rm_matching_send(nw_state * ns,
int index = 0; int index = 0;
qlist_for_each(ent, &ns->arrival_queue){ qlist_for_each(ent, &ns->arrival_queue){
qi = qlist_entry(ent, mpi_msgs_queue, ql); qi = qlist_entry(ent, mpi_msgs_queue, ql);
if((qi->num_bytes == qitem->num_bytes) if(//(qi->num_bytes == qitem->num_bytes) // it is not a requirement in MPI that the send and receive sizes match
&& (qi->tag == qitem->tag || qitem->tag == -1) // &&
(qi->tag == qitem->tag || qitem->tag == -1)
&& ((qi->source_rank == qitem->source_rank) || qitem->source_rank == -1)) && ((qi->source_rank == qitem->source_rank) || qitem->source_rank == -1))
{ {
qitem->num_bytes = qi->num_bytes;
matched = 1; matched = 1;
break; break;
} }
...@@ -1145,6 +1155,10 @@ void nw_test_init(nw_state* s, tw_lp* lp) ...@@ -1145,6 +1155,10 @@ void nw_test_init(nw_state* s, tw_lp* lp)
s->local_rank = lid.rank; s->local_rank = lid.rank;
// printf("network LP nw id %d app id %d local rank %d generating events, lp gid is %ld \n", s->nw_id, // printf("network LP nw id %d app id %d local rank %d generating events, lp gid is %ld \n", s->nw_id,
// s->app_id, s->local_rank, lp->gid); // s->app_id, s->local_rank, lp->gid);
#ifdef ENABLE_CORTEX_PYTHON
strcpy(params_d.cortex_script, cortex_file);
strcpy(params_d.cortex_class, cortex_class);
#endif
} }
wrkld_id = codes_workload_load("dumpi-trace-workload", params, s->app_id, s->local_rank); wrkld_id = codes_workload_load("dumpi-trace-workload", params, s->app_id, s->local_rank);
...@@ -1515,6 +1529,10 @@ const tw_optdef app_opt [] = ...@@ -1515,6 +1529,10 @@ const tw_optdef app_opt [] =
TWOPT_CHAR("lp-io-dir", lp_io_dir, "Where to place io output (unspecified -> no output"), TWOPT_CHAR("lp-io-dir", lp_io_dir, "Where to place io output (unspecified -> no output"),
TWOPT_UINT("lp-io-use-suffix", lp_io_use_suffix, "Whether to append uniq suffix to lp-io directory (default 0)"), TWOPT_UINT("lp-io-use-suffix", lp_io_use_suffix, "Whether to append uniq suffix to lp-io directory (default 0)"),
TWOPT_CHAR("offset_file", offset_file, "offset file name"), TWOPT_CHAR("offset_file", offset_file, "offset file name"),
#ifdef ENABLE_CORTEX_PYTHON
TWOPT_CHAR("cortex-file", cortex_file, "Python file (without .py) containing the CoRtEx translation class"),
TWOPT_CHAR("cortex-class", cortex_class, "Python class implementing the CoRtEx translator"),
#endif
TWOPT_END() TWOPT_END()
}; };
...@@ -1555,8 +1573,14 @@ int main( int argc, char** argv ) ...@@ -1555,8 +1573,14 @@ int main( int argc, char** argv )
{ {
if(tw_ismaster()) if(tw_ismaster())
printf("Usage: mpirun -np n ./modelnet-mpi-replay --sync=1/3" printf("Usage: mpirun -np n ./modelnet-mpi-replay --sync=1/3"
" --workload_type=dumpi --workload_conf_file=prefix-workload-file-name" " --workload_type=dumpi"
" --alloc_file=alloc-file-name -- config-file-name\n" " --workload_conf_file=prefix-workload-file-name"
" --alloc_file=alloc-file-name"
#ifdef ENABLE_CORTEX_PYTHON
" --cortex-file=cortex-file-name"
" --cortex-class=cortex-class-name"
#endif
" -- config-file-name\n"
"See model-net/doc/README.dragonfly.txt and model-net/doc/README.torus.txt" "See model-net/doc/README.dragonfly.txt and model-net/doc/README.torus.txt"
" for instructions on how to run the models with network traces "); " for instructions on how to run the models with network traces ");
tw_end(); tw_end();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment