Commit ae514ea2 authored by Misbah Mubarak's avatar Misbah Mubarak

Merge branch 'master' into 'master'

Adding Cortex generation of events

See merge request !23
parents 14c34910 aebf1b5d
......@@ -72,6 +72,7 @@ struct dumpi_trace_params {
#ifdef ENABLE_CORTEX_PYTHON
char cortex_script[MAX_NAME_LENGTH_WKLD];
char cortex_class[MAX_NAME_LENGTH_WKLD];
char cortex_gen[MAX_NAME_LENGTH_WKLD];
#endif
};
......
......@@ -140,7 +140,7 @@ 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],
AC_CHECK_FILES([${with_python}/lib/libpython2.7.so ${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"
......
......@@ -54,8 +54,9 @@ struct codes_jobmap_params_list jobmap_p;
/* Variables for Cortex Support */
/* Matthieu's additions start */
#ifdef ENABLE_CORTEX_PYTHON
static char cortex_file[512];
static char cortex_class[512];
static char cortex_file[512] = "\0";
static char cortex_class[512] = "\0";
static char cortex_gen[512] = "\0";
#endif
/* Matthieu's additions end */
......@@ -1158,6 +1159,7 @@ void nw_test_init(nw_state* s, tw_lp* lp)
#ifdef ENABLE_CORTEX_PYTHON
strcpy(params_d.cortex_script, cortex_file);
strcpy(params_d.cortex_class, cortex_class);
strcpy(params_d.cortex_gen, cortex_gen);
#endif
}
......@@ -1534,6 +1536,7 @@ const tw_optdef app_opt [] =
#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"),
TWOPT_CHAR("cortex-gen", cortex_gen, "Python function to pre-generate MPI events"),
#endif
TWOPT_END()
};
......
......@@ -23,12 +23,12 @@
#include <cortex/cortex-python.h>
#endif
#define PROFILE_TYPE cortex_dumpi_profile*
#define UNDUMPI_OPEN cortex_undumpi_open
//#define UNDUMPI_OPEN cortex_undumpi_open
#define DUMPI_START_STREAM_READ cortex_dumpi_start_stream_read
#define UNDUMPI_CLOSE cortex_undumpi_close
#else
#define PROFILE_TYPE dumpi_profile*
#define UNDUMPI_OPEN undumpi_open
//#define UNDUMPI_OPEN undumpi_open
#define DUMPI_START_STREAM_READ dumpi_start_stream_read
#define UNDUMPI_CLOSE undumpi_close
#endif
......@@ -646,7 +646,11 @@ int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank)
else
sprintf(file_name, "%s%d.bin", dumpi_params->file_name, rank);
#ifdef ENABLE_CORTEX
profile = cortex_undumpi_open(file_name, app_id, dumpi_params->num_net_traces, rank);
if(strcmp(dumpi_params->file_name,"none") == 0) {
profile = cortex_undumpi_open(NULL, app_id, dumpi_params->num_net_traces, rank);
} else {
profile = cortex_undumpi_open(file_name, app_id, dumpi_params->num_net_traces, rank);
}
#else
profile = undumpi_open(file_name);
#endif
......@@ -728,7 +732,11 @@ int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank)
#ifdef ENABLE_CORTEX
#ifdef ENABLE_CORTEX_PYTHON
libundumpi_populate_callbacks(CORTEX_PYTHON_TRANSLATION, transarr);
if(dumpi_params->cortex_script[0] != 0) {
libundumpi_populate_callbacks(CORTEX_PYTHON_TRANSLATION, transarr);
} else {
libundumpi_populate_callbacks(CORTEX_MPICH_TRANSLATION, transarr);
}
#else
libundumpi_populate_callbacks(CORTEX_MPICH_TRANSLATION, transarr);
#endif
......@@ -738,7 +746,16 @@ int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank)
//dumpi_free_header(trace_header);
#ifdef ENABLE_CORTEX_PYTHON
cortex_python_set_module(dumpi_params->cortex_script,dumpi_params->cortex_class);
if(dumpi_params->cortex_script[0] != 0) {
if(dumpi_params->cortex_class[0] != 0) {
cortex_python_set_module(dumpi_params->cortex_script, dumpi_params->cortex_class);
} else {
cortex_python_set_module(dumpi_params->cortex_script, NULL);
}
if(dumpi_params->cortex_gen[0] != 0) {
cortex_python_call_generator(profile, dumpi_params->cortex_gen);
}
}
#endif
int finalize_reached = 0;
......
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