XBT_PUBLIC(int) smpi_sample_2(int global, const char *file, int line);
XBT_PUBLIC(void) smpi_sample_3(int global, const char *file, int line);
+/**
+ * Need a public setter for SMPI copy_callback function, so users can define
+ * their own while still using default SIMIX_copy_callback for MSG copies.
+ */
+XBT_PUBLIC(void) smpi_comm_set_copy_data_callback(void (*callback));
+
/**
* Functions for call location tracing. These functions will be
* called from the user's application! (With the __FILE__ and __LINE__ values
XBT_PRIVATE void smpi_comm_null_copy_buffer_callback(smx_activity_t comm, void *buff, size_t buff_size);
+static void (*smpi_comm_copy_data_callback) (smx_activity_t, void*, size_t) = &smpi_comm_copy_buffer_callback;
+
XBT_PRIVATE void print_request(const char *message, MPI_Request request);
XBT_PRIVATE int smpi_enabled();
// we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
request->real_size=request->size;
request->action = simcall_comm_irecv(SIMIX_process_self(), mailbox, request->buf, &request->real_size, &match_recv,
- ! smpi_process_get_replaying()? &smpi_comm_copy_buffer_callback
+ ! smpi_process_get_replaying()? smpi_comm_copy_data_callback
: &smpi_comm_null_copy_buffer_callback, request, -1.0);
XBT_DEBUG("recv simcall posted");
request->action = simcall_comm_isend(SIMIX_process_from_PID(request->src+1), mailbox, request->size, -1.0,
buf, request->real_size, &match_send,
&xbt_free_f, // how to free the userdata if a detached send fails
- !smpi_process_get_replaying() ? &smpi_comm_copy_buffer_callback
+ !smpi_process_get_replaying() ? smpi_comm_copy_data_callback
: &smpi_comm_null_copy_buffer_callback, request,
// detach if msg size < eager/rdv switch limit
request->detached);
message, request, request->buf, request->size, request->src, request->dst, request->tag, request->flags);
}
+void smpi_comm_set_copy_data_callback(void (*callback) (smx_activity_t, void*, size_t))
+{
+ smpi_comm_copy_data_callback = callback;
+}
+
void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t buff_size)
{
XBT_DEBUG("Copy the data over");
// parse the platform file: get the host list
SIMIX_create_environment(argv[1]);
- SIMIX_comm_set_copy_data_callback(&smpi_comm_copy_buffer_callback);
+ SIMIX_comm_set_copy_data_callback(smpi_comm_copy_data_callback);
SIMIX_function_register_default(realmain);
SIMIX_launch_application(argv[2]);