\r
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/io)\r
\r
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/gpu)\r
+\r
if(HAVE_TRACING)\r
add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/tracing)\r
endif(HAVE_TRACING)\r
--- /dev/null
+cmake_minimum_required(VERSION 2.6)
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+add_executable(test_MSG_gpu_task_create "test_MSG_gpu_task_create.c")
+
+### Add definitions for compile
+target_link_libraries(test_MSG_gpu_task_create simgrid m )
+
--- /dev/null
+/* Copyright (c) 2007, 2008, 2009, 2010. 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 <stdio.h>
+#include <stdlib.h>
+#include "msg/msg.h"
+#include "xbt/log.h"
+#include "xbt/asserts.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+ "Messages specific for GPU msg example");
+
+
+/** Main function */
+int main(int argc, char *argv[])
+{
+ MSG_error_t res = MSG_OK;
+
+ MSG_global_init(&argc, argv);
+
+ m_gpu_task_t mytask = NULL;
+
+ mytask = MSG_gpu_task_create("testTask", 2000.0, 20.0, 20.0);
+
+
+
+ MSG_clean();
+
+ if (res == MSG_OK)
+ return 0;
+ else
+ return 1;
+} /* end_of_main */
@{ */
typedef struct m_task *m_task_t;
+
+/*************** Begin GPU ***************/
+typedef struct simdata_gpu_task *simdata_gpu_task_t;
+
+/** @brief GPU task datatype
+ @ingroup m_datatypes_management_details */
+typedef struct m_gpu_task {
+ char *name; /**< @brief task name if any */
+ simdata_gpu_task_t simdata; /**< @brief simulator data */
+#ifdef HAVE_TRACING
+ long long int counter; /* task unique identifier for instrumentation */
+ char *category; /* task category for instrumentation */
+#endif
+} s_m_gpu_task_t;
+
+/** @brief GPU task datatype
+ @ingroup m_datatypes_management
+
+ A <em>task</em> may then be defined by a <em>computing
+ amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
+ \see m_task_management
+ @{ */
+typedef struct m_gpu_task *m_gpu_task_t;
+/*************** End GPU ***************/
+
/**
* \brief @brief Communication action
* \ingroup m_datatypes_management
XBT_PUBLIC(m_task_t) MSG_task_create(const char *name,
double compute_duration,
double message_size, void *data);
+XBT_PUBLIC(m_gpu_task_t) MSG_gpu_task_create(const char *name,
+ double compute_duration,
+ double dispatch_latency,
+ double collect_latency);
XBT_PUBLIC(m_task_t) MSG_parallel_task_create(const char *name,
int host_nb,
const m_host_t * host_list,
double *comm_amount;
} s_simdata_task_t;
+
+/*************** Begin GPU ***************/
+typedef struct simdata_gpu_task {
+ double computation_amount; /* Computation size */
+ double dispatch_latency;
+ double collect_latency;
+ int isused; /* Indicates whether the task is used in SIMIX currently */
+} s_simdata_gpu_task_t;
+/*************** End GPU ***************/
+
/******************************* Process *************************************/
typedef struct simdata_process {
return task;
}
+/*************** Begin GPU ***************/
+/** \ingroup m_task_management
+ * \brief Creates a new #m_gpu_task_t.
+
+ * A constructor for #m_gpu_task_t taking four arguments and returning
+ a pointer to the new created GPU task.
+
+ * \param name a name for the object. It is for user-level information
+ and can be NULL.
+
+ * \param compute_duration a value of the processing amount (in flop)
+ needed to process this new task. If 0, then it cannot be executed with
+ MSG_gpu_task_execute(). This value has to be >=0.
+
+ * \param dispatch_latency time in seconds to load this task on the GPU
+
+ * \param collect_latency time in seconds to transfer result from the GPU
+ back to the CPU (host) when done
+
+ * \see m_gpu_task_t
+ * \return The new corresponding object.
+ */
+m_gpu_task_t MSG_gpu_task_create(const char *name, double compute_duration,
+ double dispatch_latency, double collect_latency)
+{
+ m_gpu_task_t task = xbt_new(s_m_gpu_task_t, 1);
+ simdata_gpu_task_t simdata = xbt_new(s_simdata_gpu_task_t, 1);
+ task->simdata = simdata;
+ /* Task structure */
+ task->name = xbt_strdup(name);
+
+ /* Simulator Data */
+ simdata->computation_amount = compute_duration;
+ simdata->dispatch_latency = dispatch_latency;
+ simdata->collect_latency = collect_latency;
+
+#ifdef HAVE_TRACING
+ //FIXME
+ TRACE_msg_gpu_task_create(task);
+#endif
+
+ return task;
+}
+/*************** End GPU ***************/
+
/** \ingroup m_task_management
* \brief Return the user data of a #m_task_t.
*