src/smpi/smpi_c99.c
src/smpi/smpi_coll.c
src/smpi/smpi_comm.c
- src/smpi/smpi_f77.c
src/smpi/smpi_global.c
src/smpi/smpi_group.c
src/smpi/smpi_mpi.c
src/smpi/smpi_pmpi.c
src/smpi/smpi_replay.c
)
+
+if(SMPI_F2C)
+ set(SMPI_SRC
+ ${SMPI_SRC}
+ src/smpi/smpi_f77.c
+ )
+endif(SMPI_F2C)
set(GRAS_RL_SRC
${XBT_RL_SRC}
if(PEXPORTS_PATH)
add_custom_command(TARGET simgrid POST_BUILD
COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/lib/libsimgrid.dll > ${CMAKE_BINARY_DIR}/lib/libsimgrid.def)
-endif(PEXPORTS_PATH)
\ No newline at end of file
+endif(PEXPORTS_PATH)
+
+if(enable_smpi)
+ add_library(smpi SHARED ${SMPI_SRC})
+ set_target_properties(smpi PROPERTIES VERSION ${libsmpi_version} OUTPUT_NAME "smpi")
+
+ set(SMPI_LDEP "")
+ target_link_libraries(smpi simgrid ${SMPI_LDEP})
+endif(enable_smpi)
\ No newline at end of file
if(HAVE_F2C_H)
include_directories(${HAVE_F2C_H})
else(HAVE_F2C_H)
- message(FATAL_ERROR "You should install f2c before use smpi.")
-endif(HAVE_F2C_H)
\ No newline at end of file
+ if(WIN32)
+ message("-- Fortran for smpi is not installed (http://www.netlib.org/f2c/).")
+ else(WIN32)
+ message(FATAL_ERROR "You should install f2c before use smpi.")
+ endif(WIN32)
+endif(HAVE_F2C_H)
+
+set(SMPI_F2C 0)
+if(HAVE_F2C_H AND F2C_EXE AND HAVE_F2C_LIB)
+ set(SMPI_F2C 1)
+endif(HAVE_F2C_H AND F2C_EXE AND HAVE_F2C_LIB)
\ No newline at end of file
/* Indicates that we have SMPI support */
#cmakedefine HAVE_SMPI @HAVE_SMPI@
+/* Indicates that we have SMPI F2C support */
+#cmakedefine SMPI_F2C @SMPI_F2C@
+
/* Indicates that we have NS3 support */
#cmakedefine HAVE_NS3 @HAVE_NS3@
*/
typedef struct s_smx_rvpoint *smx_rdv_t;
+XBT_PUBLIC(void*) SIMIX_comm_get_src_data(smx_action_t action);
+XBT_PUBLIC(void*) SIMIX_comm_get_dst_data(smx_action_t action);
+
/******************************** Context *************************************/
typedef struct s_smx_context *smx_context_t;
typedef struct s_smx_context_factory *smx_context_factory_t;
e_smx_state_t SIMIX_comm_get_state(smx_action_t action);
void SIMIX_comm_suspend(smx_action_t action);
void SIMIX_comm_resume(smx_action_t action);
-void* SIMIX_comm_get_src_data(smx_action_t action);
-void* SIMIX_comm_get_dst_data(smx_action_t action);
smx_process_t SIMIX_comm_get_src_proc(smx_action_t action);
smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action);
#include "xbt/xbt_os_time.h"
#include "simgrid/simix.h"
#include "smpi/smpi.h"
+#ifdef SMPI_F2C
#include "smpi/smpif.h"
+#endif
#include "smpi/smpi_cocci.h"
#include "instr/instr_private.h"
#include "xbt/ex.h"
#include "surf/surf.h"
+#ifndef WIN32
#include <sys/mman.h>
+#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
return (size_t)st.st_size;
}
+#ifndef WIN32
static void* shm_map(int fd, size_t size, shared_data_t* data) {
void* mem;
char loc[PTR_STRLEN];
xbt_die("Could not truncate fd %d to %zu: %s", fd, size, strerror(errno));
}
}
+
mem = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if(mem == MAP_FAILED) {
xbt_die("Could not map fd %d: %s", fd, strerror(errno));
XBT_DEBUG("MMAP %zu to %p", size, mem);
return mem;
}
+#endif
void smpi_bench_destroy(void)
{
now = SIMIX_get_clock();
if (tv) {
tv->tv_sec = (time_t)now;
+#ifdef WIN32
+ tv->tv_usec = (useconds_t)((now - tv->tv_sec) * 1e6);
+#else
tv->tv_usec = (suseconds_t)((now - tv->tv_sec) * 1e6);
+#endif
}
smpi_bench_begin();
return 0;
data->benching = 0;
}
+#ifndef WIN32
void *smpi_shared_malloc(size_t size, const char *file, int line)
{
char *loc = bprintf("%zu_%s_%d", (size_t)getpid(), file, line);
XBT_DEBUG("Malloc %zu in %p (metadata at %p)", size, mem, data);
return mem;
}
-
void smpi_shared_free(void *ptr)
{
char loc[PTR_STRLEN];
free(data->loc);
}
}
+#endif
int smpi_shared_known_call(const char* func, const char* input) {
char* loc = bprintf("%s:%s", func, input);
return data->argc ? *(data->argc) - 1 : 0;
}
+#ifdef SMPI_F2C
int smpi_process_getarg(integer* index, char* dst, ftnlen len) {
smpi_process_data_t data = smpi_process_data();
char* arg;
}
return 0;
}
+#endif
int smpi_global_size(void) {
char* value = getenv("SMPI_GLOBAL_SIZE");
return MAIN__();
}
+#ifdef WIN32
+#include <windows.h>
+
+int __attribute__((weak)) smpi_simulated_main(int argc, char** argv) {
+ xbt_die("Should not be in this smpi_simulated_main");
+ return 1;
+}
+
+/* TODO FOR WIN32 */
+/* Dummy prototype to make gcc happy */
+int APIENTRY WinMain(HINSTANCE hInst,HINSTANCE hInst2,LPSTR lpstr01,int nCmdShow)
+{
+ return MAIN__();
+}
+
+#endif
+
int MAIN__(void)
{
srand(SMPI_RAND_SEED);
int size;
} s_dyn_light_t, *dyn_light_t;
-double sg_maxmin_precision = 0.00001;
+XBT_PUBLIC(double) sg_maxmin_precision = 0.00001;
static void *lmm_variable_mallocator_new_f(void);
static void lmm_variable_mallocator_free_f(void *var);