file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mc/")
foreach(x replay
- trace trace_simple trace_call_location energy)
+ trace trace_simple trace_call_location energy load_balancer)
add_executable (smpi_${x} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x})
target_link_libraries(smpi_${x} simgrid)
set_target_properties(smpi_${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
ADD_TESH(smpi-tracing-call-location --setenv bindir=${CMAKE_BINARY_DIR}/examples/smpi/trace_call_location --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/examples/smpi/trace_call_location ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_call_location/trace_call_location.tesh)
ADD_TESH(smpi-replay --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/replay.tesh)
ADD_TESH_FACTORIES(smpi-energy "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/smpi/energy --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/bin --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/energy.tesh)
+
+ ADD_TESH(sampi-load-balancer --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/load_balancer/load_balancer.tesh)
endif()
--- /dev/null
+/* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <simgrid/s4u/Actor.hpp>
+#include "smpi/smpi.h"
+#include "smpi/sampi.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_plugin_load_balancer_example, smpi, "Simple tracing test for SAMPI functions");
+
+int main(int argc, char* argv[])
+{
+ MPI_Init(&argc, &argv);
+ void* pointer = malloc(100 * sizeof(int));
+ free(pointer);
+ pointer = malloc(100 * sizeof(int));
+ int rank;
+ int err = MPI_Comm_rank(MPI_COMM_WORLD, &rank); /* Get id of this process */
+ if (err != MPI_SUCCESS) {
+ fprintf(stderr, "MPI_Comm_rank failed: %d", err);
+ MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
+ exit(EXIT_FAILURE);
+ }
+ AMPI_Iteration_in(MPI_COMM_WORLD);
+ simgrid::s4u::this_actor::sleep_for(rank);
+ AMPI_Iteration_out(MPI_COMM_WORLD);
+
+ AMPI_Iteration_in(MPI_COMM_WORLD);
+ simgrid::s4u::this_actor::sleep_for(rank);
+ AMPI_Iteration_out(MPI_COMM_WORLD);
+ if (rank == 0)
+ free(pointer);
+ AMPI_Migrate(MPI_COMM_WORLD);
+ if (rank != 0)
+ free(pointer);
+ /* Connect your callback function to the "blah" event in the trace files */
+ //xbt_replay_action_register("blah", action_blah);
+
+ /* The send action is an override, so we have to first save its previous value in a global */
+ //int rank;
+ //MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+ //if (rank == 0) {
+ //previous_send = xbt_replay_action_get("send");
+ //xbt_replay_action_register("send", overriding_send);
+ //}
+ /* The regular run of the replayer */
+ //smpi_replay_main(&argc, &argv);
+ MPI_Finalize();
+ return 0;
+}
+
--- /dev/null
+# use the tested library, not the installed one
+# (since we want to pass it to the child, it has to be redefined before each command)
+# Go for the first test
+
+p Test if the load balancing code gets traced correctly
+! timeout 60
+
+$ ../../smpi_script/bin/smpirun -trace-ti --cfg=tracing/filename:${bindir:=.}/smpi_trace.trace --cfg=tracing/smpi/format/ti-one-file:yes -no-privatize -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./load_balancer/smpi_load_balancer load_balancer/actions_bcast.txt --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+
+$ bash -c "cat ${bindir:=.}/smpi_trace.trace_files/*"
+> 0 init
+> 0 iteration_in
+> 0 iteration_out
+> 0 iteration_in
+> 0 iteration_out
+> 0 migrate 0
+> 0 finalize
+> 1 init
+> 1 iteration_in
+> 2 init
+> 2 iteration_in
+> 1 iteration_out
+> 1 iteration_in
+> 2 iteration_out
+> 2 iteration_in
+> 1 iteration_out
+> 1 migrate 400
+> 1 finalize
+> 2 iteration_out
+> 2 migrate 400
+> 2 finalize
+
+$ rm -rf ${bindir:=.}/smpi_trace.trace
+$ rm -rf ${bindir:=.}/smpi_trace.trace_files