Browse Source

Combine max number of fxt mpi files for traces macro and place in configure

Lucas Nesi 5 years ago
parent
commit
fe0baddeb6

+ 8 - 0
configure.ac

@@ -2221,6 +2221,14 @@ AC_MSG_RESULT($nmaxbuffers)
 AC_DEFINE_UNQUOTED(STARPU_NMAXBUFS, [$nmaxbuffers],
 AC_DEFINE_UNQUOTED(STARPU_NMAXBUFS, [$nmaxbuffers],
 		[how many buffers can be manipulated per task])
 		[how many buffers can be manipulated per task])
 
 
+AC_MSG_CHECKING(how many MPI nodes fxt files can be manipulated when generating traces)
+AC_ARG_ENABLE(fxt-max-files, [AS_HELP_STRING([--enable-fxt-max-files=<nbuffers>],
+			[maximum number of mpi nodes for traces])],
+			nmaxfxtfiles=$enableval, nmaxfxtfiles=64)
+AC_MSG_RESULT($nmaxfxtfiles)
+AC_DEFINE_UNQUOTED(STARPU_FXT_MAX_FILES, [$nmaxfxtfiles],
+		[how many MPI nodes fxt files can be manipulated when generating traces])
+
 AC_MSG_CHECKING(maximum number of memory nodes to use per MPI rank)
 AC_MSG_CHECKING(maximum number of memory nodes to use per MPI rank)
 AC_ARG_ENABLE(maxnodes, [AS_HELP_STRING([--enable-maxnodes=<nnodes>],
 AC_ARG_ENABLE(maxnodes, [AS_HELP_STRING([--enable-maxnodes=<nnodes>],
 			[maximum number of memory nodes per MPI rank])],
 			[maximum number of memory nodes per MPI rank])],

+ 9 - 0
doc/doxygen/chapters/510_configure_options.doxy

@@ -527,6 +527,15 @@ Define the maximum number of buffers that tasks will be able to take
 as parameters, then available as the macro ::STARPU_NMAXBUFS.
 as parameters, then available as the macro ::STARPU_NMAXBUFS.
 </dd>
 </dd>
 
 
+<dt>--enable-fxt-max-files=<c>count</c></dt>
+<dd>
+\anchor enable-fxt-max-files
+\addindex __configure__--enable-fxt-max-files
+Use at most <c>count</c> mpi nodes fxt files for generating traces.  This information is then available as
+the macro ::STARPU_FXT_MAX_FILES.  This information is used by FxT tools when considering multi node traces.
+Default value is 64.
+</dd>
+
 <dt>--enable-allocation-cache</dt>
 <dt>--enable-allocation-cache</dt>
 <dd>
 <dd>
 \anchor enable-allocation-cache
 \anchor enable-allocation-cache

+ 9 - 0
include/starpu_config.h.in

@@ -186,6 +186,15 @@
 #undef STARPU_NMAXBUFS
 #undef STARPU_NMAXBUFS
 
 
 /**
 /**
+   Define the maximum number of fxt mpi files that can be read when
+   generating traces. The default value is 64, it can be changed by
+   using the configure option \ref enable-fxt-max-files
+   "--enable-fxt-max-files".
+   @ingroup API_MPI_Support
+*/
+#undef STARPU_FXT_MAX_FILES
+
+/**
    Define the maximum number of CPU workers managed by StarPU. The
    Define the maximum number of CPU workers managed by StarPU. The
    default value can be modified at configure by using the option \ref
    default value can be modified at configure by using the option \ref
    enable-maxcpus "--enable-maxcpus".
    enable-maxcpus "--enable-maxcpus".

+ 1 - 2
include/starpu_fxt.h

@@ -20,6 +20,7 @@
 #ifndef __STARPU_FXT_H__
 #ifndef __STARPU_FXT_H__
 #define __STARPU_FXT_H__
 #define __STARPU_FXT_H__
 
 
+#include <starpu_config.h>
 #include <starpu_perfmodel.h>
 #include <starpu_perfmodel.h>
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
@@ -32,8 +33,6 @@ extern "C"
    @{
    @{
 */
 */
 
 
-#define STARPU_FXT_MAX_FILES	64
-
 struct starpu_fxt_codelet_event
 struct starpu_fxt_codelet_event
 {
 {
 	char symbol[256];
 	char symbol[256];

+ 2 - 2
src/debug/traces/starpu_fxt.c

@@ -1194,8 +1194,8 @@ static void handle_new_mem_node(struct fxt_ev_64 *ev, struct starpu_fxt_options
  */
  */
 static int create_ordered_stream_id (int nodeid, int devid)
 static int create_ordered_stream_id (int nodeid, int devid)
 {
 {
-	static int stable[MAX_MPI_NODES][STARPU_MAXCUDADEVS];
+	static int stable[STARPU_FXT_MAX_FILES][STARPU_MAXCUDADEVS];
-	STARPU_ASSERT(nodeid < MAX_MPI_NODES);
+	STARPU_ASSERT(nodeid < STARPU_FXT_MAX_FILES);
 	STARPU_ASSERT(devid < STARPU_MAXCUDADEVS);
 	STARPU_ASSERT(devid < STARPU_MAXCUDADEVS);
 	return stable[nodeid][devid]++;
 	return stable[nodeid][devid]++;
 }
 }

+ 0 - 2
src/debug/traces/starpu_fxt.h

@@ -41,8 +41,6 @@
 #include <starpu.h>
 #include <starpu.h>
 #include "../../../include/starpu_fxt.h"
 #include "../../../include/starpu_fxt.h"
 
 
-#define MAX_MPI_NODES 64
-
 extern char _starpu_last_codelet_symbol[STARPU_NMAXWORKERS][(FXT_MAX_PARAMS-5)*sizeof(unsigned long)];
 extern char _starpu_last_codelet_symbol[STARPU_NMAXWORKERS][(FXT_MAX_PARAMS-5)*sizeof(unsigned long)];
 
 
 void _starpu_fxt_dag_init(char *dag_filename);
 void _starpu_fxt_dag_init(char *dag_filename);

+ 19 - 19
src/debug/traces/starpu_fxt_mpi.c

@@ -103,27 +103,27 @@ int _starpu_fxt_mpi_find_sync_point(char *filename_in, uint64_t *offset, int *ke
  */
  */
 
 
 /* the list of MPI transfers found in the different traces */
 /* the list of MPI transfers found in the different traces */
-static struct mpi_transfer *mpi_sends[MAX_MPI_NODES] = {NULL};
+static struct mpi_transfer *mpi_sends[STARPU_FXT_MAX_FILES] = {NULL};
-static struct mpi_transfer *mpi_recvs[MAX_MPI_NODES] = {NULL};
+static struct mpi_transfer *mpi_recvs[STARPU_FXT_MAX_FILES] = {NULL};
 
 
 /* number of available slots in the lists  */
 /* number of available slots in the lists  */
-unsigned mpi_sends_list_size[MAX_MPI_NODES] = {0};
+unsigned mpi_sends_list_size[STARPU_FXT_MAX_FILES] = {0};
-unsigned mpi_recvs_list_size[MAX_MPI_NODES] = {0};
+unsigned mpi_recvs_list_size[STARPU_FXT_MAX_FILES] = {0};
 
 
 /* number of slots actually used in the list  */
 /* number of slots actually used in the list  */
-unsigned mpi_sends_used[MAX_MPI_NODES] = {0};
+unsigned mpi_sends_used[STARPU_FXT_MAX_FILES] = {0};
-unsigned mpi_recvs_used[MAX_MPI_NODES] = {0};
+unsigned mpi_recvs_used[STARPU_FXT_MAX_FILES] = {0};
 
 
 /* number of slots already matched at the beginning of the list. This permits
 /* number of slots already matched at the beginning of the list. This permits
  * going through the lists from the beginning to match each and every
  * going through the lists from the beginning to match each and every
  * transfer, thus avoiding a quadratic complexity. */
  * transfer, thus avoiding a quadratic complexity. */
-unsigned mpi_recvs_matched[MAX_MPI_NODES][MAX_MPI_NODES] = { {0} };
+unsigned mpi_recvs_matched[STARPU_FXT_MAX_FILES][STARPU_FXT_MAX_FILES] = { {0} };
-unsigned mpi_sends_matched[MAX_MPI_NODES][MAX_MPI_NODES] = { {0} };
+unsigned mpi_sends_matched[STARPU_FXT_MAX_FILES][STARPU_FXT_MAX_FILES] = { {0} };
 
 
 void _starpu_fxt_mpi_add_send_transfer(int src, int dst STARPU_ATTRIBUTE_UNUSED, long mpi_tag, size_t size, float date, long jobid, unsigned long handle)
 void _starpu_fxt_mpi_add_send_transfer(int src, int dst STARPU_ATTRIBUTE_UNUSED, long mpi_tag, size_t size, float date, long jobid, unsigned long handle)
 {
 {
 	STARPU_ASSERT(src >= 0);
 	STARPU_ASSERT(src >= 0);
-	if (src >= MAX_MPI_NODES)
+	if (src >= STARPU_FXT_MAX_FILES)
 		return;
 		return;
 	unsigned slot = mpi_sends_used[src]++;
 	unsigned slot = mpi_sends_used[src]++;
 
 
@@ -153,7 +153,7 @@ void _starpu_fxt_mpi_add_send_transfer(int src, int dst STARPU_ATTRIBUTE_UNUSED,
 
 
 void _starpu_fxt_mpi_add_recv_transfer(int src STARPU_ATTRIBUTE_UNUSED, int dst, long mpi_tag, float date, long jobid, unsigned long handle)
 void _starpu_fxt_mpi_add_recv_transfer(int src STARPU_ATTRIBUTE_UNUSED, int dst, long mpi_tag, float date, long jobid, unsigned long handle)
 {
 {
-	if (dst >= MAX_MPI_NODES)
+	if (dst >= STARPU_FXT_MAX_FILES)
 		return;
 		return;
 	unsigned slot = mpi_recvs_used[dst]++;
 	unsigned slot = mpi_recvs_used[dst]++;
 
 
@@ -220,11 +220,11 @@ static unsigned long mpi_com_id = 0;
 
 
 static void display_all_transfers_from_trace(FILE *out_paje_file, FILE *out_comms_file, unsigned n)
 static void display_all_transfers_from_trace(FILE *out_paje_file, FILE *out_comms_file, unsigned n)
 {
 {
-	unsigned slot[MAX_MPI_NODES] = { 0 }, node;
+	unsigned slot[STARPU_FXT_MAX_FILES] = { 0 }, node;
 	unsigned nb_wrong_comm_timing = 0;
 	unsigned nb_wrong_comm_timing = 0;
 	struct mpi_transfer_list pending_receives; /* Sorted list of matches which have not happened yet */
 	struct mpi_transfer_list pending_receives; /* Sorted list of matches which have not happened yet */
-	double current_out_bandwidth[MAX_MPI_NODES] = { 0. };
+	double current_out_bandwidth[STARPU_FXT_MAX_FILES] = { 0. };
-	double current_in_bandwidth[MAX_MPI_NODES] = { 0. };
+	double current_in_bandwidth[STARPU_FXT_MAX_FILES] = { 0. };
 #ifdef STARPU_HAVE_POTI
 #ifdef STARPU_HAVE_POTI
 	char mpi_container[STARPU_POTI_STR_LEN];
 	char mpi_container[STARPU_POTI_STR_LEN];
 #endif
 #endif
@@ -246,7 +246,7 @@ static void display_all_transfers_from_trace(FILE *out_paje_file, FILE *out_comm
 		else
 		else
 			start_date = mpi_transfer_list_front(&pending_receives)->date;
 			start_date = mpi_transfer_list_front(&pending_receives)->date;
 
 
-		src = MAX_MPI_NODES;
+		src = STARPU_FXT_MAX_FILES;
 		for (node = 0; node < n; node++)
 		for (node = 0; node < n; node++)
 		{
 		{
 			if (slot[node] < mpi_sends_used[node] && mpi_sends[node][slot[node]].date < start_date)
 			if (slot[node] < mpi_sends_used[node] && mpi_sends[node][slot[node]].date < start_date)
@@ -260,7 +260,7 @@ static void display_all_transfers_from_trace(FILE *out_paje_file, FILE *out_comm
 			/* No event any more, we're finished! */
 			/* No event any more, we're finished! */
 			break;
 			break;
 
 
-		if (src == MAX_MPI_NODES)
+		if (src == STARPU_FXT_MAX_FILES)
 		{
 		{
 			/* Pending match is earlier than all new sends, finish its communication */
 			/* Pending match is earlier than all new sends, finish its communication */
 			match = mpi_transfer_list_pop_front(&pending_receives);
 			match = mpi_transfer_list_pop_front(&pending_receives);
@@ -284,7 +284,7 @@ static void display_all_transfers_from_trace(FILE *out_paje_file, FILE *out_comm
 		size_t size = cur->size;
 		size_t size = cur->size;
 		unsigned long send_handle = cur->handle;
 		unsigned long send_handle = cur->handle;
 
 
-		if (dst < MAX_MPI_NODES)
+		if (dst < STARPU_FXT_MAX_FILES)
 			match = try_to_match_send_transfer(src, dst, mpi_tag);
 			match = try_to_match_send_transfer(src, dst, mpi_tag);
 		else
 		else
 			match = NULL;
 			match = NULL;
@@ -377,10 +377,10 @@ static void display_all_transfers_from_trace(FILE *out_paje_file, FILE *out_comm
 
 
 void _starpu_fxt_display_mpi_transfers(struct starpu_fxt_options *options, int *ranks STARPU_ATTRIBUTE_UNUSED, FILE *out_paje_file, FILE* out_comms_file)
 void _starpu_fxt_display_mpi_transfers(struct starpu_fxt_options *options, int *ranks STARPU_ATTRIBUTE_UNUSED, FILE *out_paje_file, FILE* out_comms_file)
 {
 {
-	if (options->ninputfiles > MAX_MPI_NODES)
+	if (options->ninputfiles > STARPU_FXT_MAX_FILES)
 	{
 	{
-		_STARPU_DISP("Warning: %u files given, maximum %u supported, truncating to %u\n", options->ninputfiles, MAX_MPI_NODES, MAX_MPI_NODES);
+		_STARPU_DISP("Warning: %u files given, maximum %u supported, truncating to %u\n", options->ninputfiles, STARPU_FXT_MAX_FILES, STARPU_FXT_MAX_FILES);
-		options->ninputfiles = MAX_MPI_NODES;
+		options->ninputfiles = STARPU_FXT_MAX_FILES;
 	}
 	}
 
 
 	/* display the MPI transfers if possible */
 	/* display the MPI transfers if possible */

+ 10 - 0
tools/starpu_fxt_tool.c

@@ -79,6 +79,11 @@ static int parse_args(int argc, char **argv)
 
 
 		if (strcmp(argv[i], "-i") == 0)
 		if (strcmp(argv[i], "-i") == 0)
 		{
 		{
+			if (options.ninputfiles >= STARPU_FXT_MAX_FILES)
+			{
+				fprintf(stderr, "Error: The number of trace files is superior to STARPU_FXT_MAX_FILES (%u)\nPlease recompile StarPU with a bigger --enable-fxt-max-files\n", STARPU_FXT_MAX_FILES);
+				return 7;
+			}
 			options.filenames[options.ninputfiles++] = argv[++i];
 			options.filenames[options.ninputfiles++] = argv[++i];
 			reading_input_filenames = 1;
 			reading_input_filenames = 1;
 			continue;
 			continue;
@@ -172,6 +177,11 @@ static int parse_args(int argc, char **argv)
 		 * assume this may be another filename */
 		 * assume this may be another filename */
 		if (reading_input_filenames)
 		if (reading_input_filenames)
 		{
 		{
+			if (options.ninputfiles >= STARPU_FXT_MAX_FILES)
+			{
+				fprintf(stderr, "Error: The number of trace files is superior to STARPU_FXT_MAX_FILES (%u)\nPlease recompile StarPU with a bigger --enable-fxt-max-files\n", STARPU_FXT_MAX_FILES);
+				return 7;
+			}
 			options.filenames[options.ninputfiles++] = argv[i];
 			options.filenames[options.ninputfiles++] = argv[i];
 			continue;
 			continue;
 		}
 		}