If you want to compile the lua bindings, you have to have lua5.1 executable and
liblua5.1-dev.
-If you want to compile smpi, you should install f2c to use Fortran code.
+If you want to compile smpi, you should install a fortran compiler to use
+ Fortran code. Only gfortran has been tested for now.
If you want to compile the GTNetS backend, you have to have a patched version of
GTNetS installed. The patch lives in the contrib section of the Git.
IF(enable_smpi AND NOT WIN32)
exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc" OUTPUT_VARIABLE "OKITOKI")
exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx" OUTPUT_VARIABLE "OKITOKI")
- exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif2c" OUTPUT_VARIABLE "OKITOKI")
exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff" OUTPUT_VARIABLE "OKITOKI")
exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90" OUTPUT_VARIABLE "OKITOKI")
exec_program("chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun" OUTPUT_VARIABLE "OKITOKI")
ADD_TEST(test-smpi-mpich3-topo-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/topo perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/topo -tests=testlist -execarg=--cfg=contexts/factory:raw)
SET_TESTS_PROPERTIES(test-smpi-mpich3-attr-raw test-smpi-mpich3-comm-raw test-smpi-mpich3-init-raw test-smpi-mpich3-datatype-raw test-smpi-mpich3-group-raw test-smpi-mpich3-pt2pt-raw test-smpi-mpich3-topo-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
ENDIF()
- IF(SMPI_F2C)
+ IF(SMPI_FORTRAN)
ADD_TEST(test-smpi-mpich3-thread-f77 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -execarg=--cfg=contexts/stack_size:8000 -execarg=--cfg=smpi/privatize_global_variables:yes)
SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f77 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
- ENDIF()
- IF(SMPI_F90)
ADD_TEST(test-smpi-mpich3-thread-f90 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f90/ perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -execarg=--cfg=smpi/privatize_global_variables:yes)
SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f90 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
ENDIF()
# BEGIN TESH TESTS
ADD_TESH_FACTORIES(smpi-energy "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/energy.tesh)
- IF(SMPI_F2C)
+ IF(SMPI_FORTRAN)
ADD_TESH_FACTORIES(smpi-energy-f77 "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/f77/energy.tesh)
- ENDIF()
- IF(SMPI_F90)
ADD_TESH_FACTORIES(smpi-energy-f90 "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/f90/energy.tesh)
ENDIF()
ADD_TESH_FACTORIES(smpi-msg-masterslave "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave --cd ${CMAKE_BINARY_DIR}/examples/smpi/smpi_msg_masterslave ${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave/msg_smpi.tesh)
endif()
if(enable_smpi)
- include(FindF2c)
- # FindGFortran must come after FindF2C, and after having set HAVE_MC
include(FindGFortran)
SET(HAVE_SMPI 1)
endif()
file(READ ${CMAKE_HOME_DIRECTORY}/src/smpi/smpitools.sh SMPITOOLS_SH)
configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/smpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/smpif.h @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/bin/smpicc @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/bin/smpicxx @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_BINARY_DIR}/bin/smpif2c @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/bin/smpiff @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/bin/smpif90 @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/bin/smpirun @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpicxx.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx @ONLY)
-configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif2c.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif2c @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpiff.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpif90.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90 @ONLY)
configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun @ONLY)
if(NOT WIN32)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx)
- execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif2c)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx)
- execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif2c)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90)
execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun)
set(generated_headers_to_install
${CMAKE_CURRENT_BINARY_DIR}/include/smpi/mpif.h
- ${CMAKE_CURRENT_BINARY_DIR}/include/smpi/smpif.h
${CMAKE_CURRENT_BINARY_DIR}/include/simgrid_config.h
)
${generated_headers_to_install}
${CMAKE_BINARY_DIR}/bin/smpicc
${CMAKE_BINARY_DIR}/bin/smpicxx
- ${CMAKE_BINARY_DIR}/bin/smpif2c
${CMAKE_BINARY_DIR}/bin/smpiff
${CMAKE_BINARY_DIR}/bin/smpif90
${CMAKE_BINARY_DIR}/bin/smpirun
src/smpi/smpi_topo.c
)
-if(SMPI_F2C)
+if(SMPI_FORTRAN)
set(SMPI_SRC
${SMPI_SRC}
src/smpi/smpi_f77.c
set(source_of_generated_headers
include/simgrid_config.h.in
include/smpi/mpif.h.in
- include/smpi/smpif.h.in
src/context_sysv_config.h.in)
### depend of some variables setted upper
${bin_files}
src/smpi/smpicc.in
src/smpi/smpicxx.in
- src/smpi/smpif2c.in
src/smpi/smpiff.in
src/smpi/smpif90.in
src/smpi/smpirun.in
buildtools/Cmake/MakeJava.cmake
buildtools/Cmake/MakeLib.cmake
buildtools/Cmake/MakeLibWin.cmake
- buildtools/Cmake/Modules/FindF2c.cmake
buildtools/Cmake/Modules/FindGFortran.cmake
buildtools/Cmake/Modules/FindGTnets.cmake
buildtools/Cmake/Modules/FindGraphviz.cmake
${CMAKE_BINARY_DIR}/bin/smpicxx
${CMAKE_BINARY_DIR}/bin/smpirun
DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
- if(SMPI_F2C)
- install(PROGRAMS
- ${CMAKE_BINARY_DIR}/bin/smpif2c
- ${CMAKE_BINARY_DIR}/bin/smpiff
- DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
- endif()
- if(SMPI_F90)
+ if(SMPI_FORTRAN)
install(PROGRAMS
${CMAKE_BINARY_DIR}/bin/smpif90
+ ${CMAKE_BINARY_DIR}/bin/smpiff
DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
endif()
endif()
COMMAND ${CMAKE_COMMAND} -E echo "uninstall lib ok"
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicc
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpicxx
- COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif2c
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpiff
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpif90
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_INSTALL_PREFIX}/bin/smpirun
+++ /dev/null
-find_program(F2C_EXE
- NAME f2c
- PATH_SUFFIXES bin/
- PATHS
- /opt
- /opt/local
- /opt/csw
- /sw
- /usr
- )
-
-if(F2C_EXE)
- message(STATUS "Looking for bin f2c - found: ${F2C_EXE}")
-else()
- message(STATUS "Looking for bin f2c - not found (http://www.netlib.org/f2c/)")
-endif()
-
-find_library(HAVE_F2C_LIB
- NAME f2c
- HINTS
- ENV LD_LIBRARY_PATH
- PATH_SUFFIXES lib/
- PATHS
- /opt
- /opt/local
- /opt/csw
- /sw
- /usr
- )
-
-if(HAVE_F2C_LIB)
- message(STATUS "Looking for lib f2c - found: ${HAVE_F2C_LIB}")
-else()
- message(STATUS "Looking for lib f2c - not found")
-endif()
-
-get_filename_component(F2C_HINT ${HAVE_F2C_LIB} PATH)
-find_path(HAVE_F2C_H f2c.h
- HINTS
- ${F2C_HINT}/..
- PATH_SUFFIXES include/
- PATHS
- /opt
- /opt/local
- /opt/csw
- /sw
- /usr
- )
-
-if(HAVE_F2C_H)
- message(STATUS "Looking for f2c.h - found: ${HAVE_F2C_H}")
-else()
- message(STATUS "Looking for f2c.h - not found")
-endif()
-
-if(HAVE_F2C_H)
- set(HAVE_SMPI_F2C_H 1)
-endif()
-
-mark_as_advanced(HAVE_F2C_H)
-mark_as_advanced(F2C_EXE)
-mark_as_advanced(HAVE_F2C_LIB)
-
-if(HAVE_F2C_LIB)
- get_filename_component(F2C_LIBRARY_PATH "${HAVE_F2C_LIB}" PATH)
- file(TO_NATIVE_PATH "${F2C_LIBRARY_PATH}" F2C_LIBRARY_PATH)
-endif()
-
-#Some old versions of 64 bits systems seem to have a different size between C and Fortran Datatypes
-#Deactivate F2C with these versions, in order to avoid breaking test cases in legacy systems (as Fedora 13)
-set(COMPILER_OK 1)
-if(PROCESSOR_x86_64 AND "${CMAKE_SYSTEM}" MATCHES "Linux" AND ${CMAKE_C_COMPILER_ID} STREQUAL "GNU" AND "4.5" STRGREATER "${COMPILER_C_VERSION_MAJOR_MINOR}" )
- set(COMPILER_OK 0)
- message("Your C compiler is a bit old and Fortran support is quite problematic on 64 bit platforms, F2C has been deactivated")
-endif()
-
-set(SMPI_F2C 0)
-if(HAVE_F2C_H AND F2C_EXE AND HAVE_F2C_LIB AND COMPILER_OK)
- set(SMPI_F2C 1)
-endif()
-
-if(SMPI_F2C)
- include_directories(${HAVE_F2C_H})
-else()
- message("-- Fortran 77 support for smpi is disabled.")
-endif()
mark_as_advanced(GFORTRAN_EXE)
message(STATUS "Looking for bin gfortran")
+set(SMPI_FORTRAN 0)
if(GFORTRAN_EXE)
message(STATUS "Found gfortran: ${GFORTRAN_EXE}")
+ set(SMPI_FORTRAN 1)
else()
message(STATUS "Looking for bin gfortran - not found")
endif()
-set(SMPI_F90 0)
-if(GFORTRAN_EXE)
- if(NOT SMPI_F2C)
- message("-- Fortran 90 support for smpi also needs f2c.")
- #elseif(HAVE_MC)
- # message("-- Fortran 90 support for smpi is currently not compatible with model checking.")
- else()
- set(SMPI_F90 1)
- endif()
-endif()
-
-if(NOT SMPI_F90)
- message("-- Fortran 90 support for smpi is disabled.")
+if(NOT SMPI_FORTRAN)
+ message("-- Fortran support for smpi is disabled.")
endif()
message(" Compile Lua .........: ${HAVE_LUA}")
message(" Compile Smpi ........: ${HAVE_SMPI}")
message(" Compile MPI testsuite: ${enable_smpi_MPICH3_testsuite}")
-message(" Compile Smpi f77 ....: ${SMPI_F2C}")
-message(" Compile Smpi f90 ....: ${SMPI_F90}")
+message(" Compile Smpi f77 ....: ${SMPI_FORTRAN}")
+message(" Compile Smpi f90 ....: ${SMPI_FORTRAN}")
message(" Compile Static ......: ${enable_lib_static}")
if(enable_java)
message(" Native lib in jar ...: ${enable_lib_in_jar}")
/* 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 SMPI FORTRAN support */
+#cmakedefine SMPI_FORTRAN @SMPI_FORTRAN@
/* Indicates that we have NS3 support */
#cmakedefine HAVE_NS3 @HAVE_NS3@
Section "SMPI Library" SMPISection\r
setOutPath $INSTDIR\bin\r
file bin\smpicc\r
- file bin\smpif2c\r
file bin\smpiff\r
file bin\smpirun\r
file bin\smpif90\r
file @CMAKE_HOME_DIRECTORY@\include\smpi\smpi_cocci.h\r
file @CMAKE_HOME_DIRECTORY@\include\smpi\smpi_main.h\r
file include\smpi\mpif.h\r
- file include\smpi\smpif.h\r
\r
CreateDirectory $INSTDIR\examples\smpi\r
file /r @CMAKE_HOME_DIRECTORY@\examples\smpi\tracing\r
delete $INSTDIR\bin\graphicator@BIN_EXE@\r
delete $INSTDIR\bin\simgrid_update_xml\r
delete $INSTDIR\bin\smpicc\r
- delete $INSTDIR\bin\smpif2c\r
delete $INSTDIR\bin\smpiff\r
delete $INSTDIR\bin\smpirun\r
delete $INSTDIR\bin\tesh\r
delete $INSTDIR\include\smpi\mpif.h\r
delete $INSTDIR\include\smpi\smpi_cocci.h\r
delete $INSTDIR\include\smpi\smpi_main.h\r
- delete $INSTDIR\include\smpi\smpif.h\r
delete $INSTDIR\include\surf\surfxml_parse.h\r
delete $INSTDIR\include\surf\simgrid_dtd.h\r
delete $INSTDIR\include\surf\surf_routing.h\r
example:
\verbatim
-### If f2c is installed compiled source other-whise source is only copy in the dist
-if(SMPI_F2C)
+### If fortran is installed compile source other-whise source is only copied in the dist
+if(SMPI_FORTRAN)
set(SMPI_SRC
${SMPI_SRC}
src/smpi/smpi_f77.c
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND SMPI_F2C)
+if(enable_smpi AND SMPI_FORTRAN)
set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND SMPI_F90)
+if(enable_smpi AND SMPI_FORTRAN)
set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+++ /dev/null
-/* Copyright (c) 2007-2014. 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. */
-
-#ifndef SMPIF_H
-#define SMPIF_H
-
-#cmakedefine SMPI_F2C @SMPI_F2C@
-
-#ifdef SMPI_F2C
-
-#include <xbt/misc.h>
-#include <smpi/smpi.h>
-/* those are defined in f2c.h */
-#undef min
-#undef max
-#include <f2c.h>
-
-XBT_PUBLIC_DATA(__thread int) smpi_current_rank;
-
-XBT_PUBLIC(int) smpi_process_argc(void);
-XBT_PUBLIC(int) smpi_process_getarg(integer* index, char* dst, ftnlen len);
-
-#define smpi_sample_local__(pi,pt) \
- { \
- if(smpi_sample_1(0, __FILE__, __LINE__, *pi, *pt)) { \
- smpi_sample_3(0, __FILE__, __LINE__); \
- } \
- if(!smpi_sample_2(0, __FILE__, __LINE__)) { \
- continue; \
- } \
- }
-
-#define smpi_sample_global__(pi,pt) \
- { \
- if(smpi_sample_1(1, __FILE__, __LINE__, *pi, *pt)) { \
- smpi_sample_3(1, __FILE__, __LINE__); \
- } \
- if(!smpi_sample_2(1, __FILE__, __LINE__)) { \
- continue; \
- } \
- }
-
-
-#endif
-
-#endif // SMPI_F2C
MC_ignore_global_variable("mc_comp_times");
MC_ignore_global_variable("mc_snapshot_comparison_time");
MC_ignore_global_variable("mc_time");
- MC_ignore_global_variable("smpi_current_rank");
MC_ignore_global_variable("counter"); /* Static variable used for tracing */
MC_ignore_global_variable("maestro_stack_start");
MC_ignore_global_variable("maestro_stack_end");
#include "simgrid/simix.h"
#include "smpi/smpi_interface.h"
#include "smpi/smpi.h"
-#include "smpi/smpif.h"
#include "smpi/smpi_cocci.h"
#include "instr/instr_private.h"
xbt_dict_t allocs_metadata = NULL; /* Allocated on first use */
xbt_dict_t samples = NULL; /* Allocated on first use */
xbt_dict_t calls = NULL; /* Allocated on first use */
-__thread int smpi_current_rank = 0; /* Updated after each MPI call */
double smpi_cpu_threshold;
double smpi_running_power;
{
switch_data_segment(smpi_process_index());
xbt_os_threadtimer_start(smpi_process_timer());
- smpi_current_rank = smpi_process_index();
}
void smpi_bench_end(void)
#include "xbt/log.h"
#include "simgrid/simix.h"
#include "smpi/smpi.h"
+#include "internal_config.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi,
"Logging specific to SMPI (experimental DVFS support)");
return simcall_host_get_consumed_energy(SIMIX_host_self());
}
-#include "smpi/smpif.h"
-#ifdef SMPI_F2C
+#ifdef SMPI_FORTRAN
+
+#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
+typedef int integer;
+typedef unsigned int uinteger;
+#else
+typedef long int integer;
+typedef unsigned long int uinteger;
+#endif
+typedef char *address;
+typedef short int shortint;
+typedef float real;
+typedef double doublereal;
+typedef struct { real r, i; } complex;
+typedef struct { doublereal r, i; } doublecomplex;
XBT_PUBLIC(doublereal) smpi_get_host_power_peak_at_(integer *pstate_index);
doublereal smpi_get_host_power_peak_at_(integer *pstate_index)
#include "private.h"
#include "xbt.h"
-extern int xargc;
-extern char** xargv;
-
static xbt_dict_t comm_lookup = NULL;
static xbt_dict_t group_lookup = NULL;
static xbt_dict_t request_lookup = NULL;
static xbt_dict_t op_lookup = NULL;
static int running_processes = 0;
+#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
+typedef int integer;
+typedef unsigned int uinteger;
+#else
+typedef long int integer;
+typedef unsigned long int uinteger;
+#endif
+
/* Bindings for MPI special values */
-union u_smpi_common {
+
struct s_smpi_common {
integer _MPI_IN_PLACE;
integer _MPI_BOTTOM;
integer _MPI_STATUS_IGNORE;
integer _MPI_STATUSES_IGNORE;
- } *f77; /* with f2c, remains NULL with gfortran */
- struct s_smpi_common f90; /* with gfortran */
-} smpi_ = { NULL };
+ } smpi_f90;
+
+
/* Convert between Fortran and C */
-#define F2C_ADDR(addr, val) \
- (((void *)(addr) == (void *)(smpi_.f77 \
- ? &smpi_.f77[smpi_current_rank]._ ## val \
- : &smpi_.f90._ ## val)) \
+#define FORT_ADDR(addr, val) \
+ (((void *)(addr) == (void*) &(smpi_f90._ ## val)) \
? (val) : (void *)(addr))
-#define F2C_BOTTOM(addr) F2C_ADDR(addr, MPI_BOTTOM)
-#define F2C_IN_PLACE(addr) F2C_ADDR(addr, MPI_IN_PLACE)
-#define F2C_STATUS_IGNORE(addr) F2C_ADDR(addr, MPI_STATUS_IGNORE)
-#define F2C_STATUSES_IGNORE(addr) F2C_ADDR(addr, MPI_STATUSES_IGNORE)
+#define FORT_BOTTOM(addr) FORT_ADDR(addr, MPI_BOTTOM)
+#define FORT_IN_PLACE(addr) FORT_ADDR(addr, MPI_IN_PLACE)
+#define FORT_STATUS_IGNORE(addr) FORT_ADDR(addr, MPI_STATUS_IGNORE)
+#define FORT_STATUSES_IGNORE(addr) FORT_ADDR(addr, MPI_STATUSES_IGNORE)
#define KEY_SIZE (sizeof(int) * 2 + 1)
new_op(MPI_BOR);
new_op(MPI_BXOR);
}
- /* smpif2c is responsible for generating a call with the final arguments */
*ierr = MPI_Init(NULL, NULL);
running_processes++;
}
void mpi_isend_(void *buf, int* count, int* datatype, int* dst,
int* tag, int* comm, int* request, int* ierr) {
MPI_Request req;
- buf = (char *) F2C_BOTTOM(buf);
+ buf = (char *) FORT_BOTTOM(buf);
*ierr = MPI_Isend(buf, *count, get_datatype(*datatype), *dst, *tag,
get_comm(*comm), &req);
if(*ierr == MPI_SUCCESS) {
void mpi_irsend_(void *buf, int* count, int* datatype, int* dst,
int* tag, int* comm, int* request, int* ierr) {
MPI_Request req;
- buf = (char *) F2C_BOTTOM(buf);
+ buf = (char *) FORT_BOTTOM(buf);
*ierr = MPI_Irsend(buf, *count, get_datatype(*datatype), *dst, *tag,
get_comm(*comm), &req);
if(*ierr == MPI_SUCCESS) {
int* comm, MPI_Status* status, int* ierr) {
*ierr = MPI_Sendrecv(sendbuf, *sendcount, get_datatype(*sendtype), *dst,
*sendtag, recvbuf, *recvcount,get_datatype(*recvtype), *src, *recvtag,
- get_comm(*comm), F2C_STATUS_IGNORE(status));
+ get_comm(*comm), FORT_STATUS_IGNORE(status));
}
void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag,
void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag,
int* comm, int* request, int* ierr) {
MPI_Request req;
- buf = (char *) F2C_BOTTOM(buf);
+ buf = (char *) FORT_BOTTOM(buf);
*ierr = MPI_Irecv(buf, *count, get_datatype(*datatype), *src, *tag,
get_comm(*comm), &req);
if(*ierr == MPI_SUCCESS) {
void mpi_wait_(int* request, MPI_Status* status, int* ierr) {
MPI_Request req = find_request(*request);
- *ierr = MPI_Wait(&req, F2C_STATUS_IGNORE(status));
+ *ierr = MPI_Wait(&req, FORT_STATUS_IGNORE(status));
if(req==MPI_REQUEST_NULL){
free_request(*request);
*request=MPI_FORTRAN_REQUEST_NULL;
for(i = 0; i < *count; i++) {
reqs[i] = find_request(requests[i]);
}
- *ierr = MPI_Waitall(*count, reqs, F2C_STATUSES_IGNORE(status));
+ *ierr = MPI_Waitall(*count, reqs, FORT_STATUSES_IGNORE(status));
for(i = 0; i < *count; i++) {
if(reqs[i]==MPI_REQUEST_NULL){
free_request(requests[i]);
void mpi_reduce_(void* sendbuf, void* recvbuf, int* count,
int* datatype, int* op, int* root, int* comm, int* ierr) {
- sendbuf = (char *) F2C_IN_PLACE(sendbuf);
- sendbuf = (char *) F2C_BOTTOM(sendbuf);
- recvbuf = (char *) F2C_BOTTOM(recvbuf);
+ sendbuf = (char *) FORT_IN_PLACE(sendbuf);
+ sendbuf = (char *) FORT_BOTTOM(sendbuf);
+ recvbuf = (char *) FORT_BOTTOM(recvbuf);
*ierr = MPI_Reduce(sendbuf, recvbuf, *count,
get_datatype(*datatype), get_op(*op), *root, get_comm(*comm));
}
void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype,
int* op, int* comm, int* ierr) {
- sendbuf = (char *) F2C_IN_PLACE(sendbuf);
+ sendbuf = (char *) FORT_IN_PLACE(sendbuf);
*ierr = MPI_Allreduce(sendbuf, recvbuf, *count, get_datatype(*datatype),
get_op(*op), get_comm(*comm));
}
void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype,
int* op, int* comm, int* ierr) {
- sendbuf = (char *) F2C_IN_PLACE(sendbuf);
+ sendbuf = (char *) FORT_IN_PLACE(sendbuf);
*ierr = MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, get_datatype(*datatype),
get_op(*op), get_comm(*comm));
}
void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype,
void* recvbuf, int* recvcount, int* recvtype,
int* root, int* comm, int* ierr) {
- recvbuf = (char *) F2C_IN_PLACE(recvbuf);
+ recvbuf = (char *) FORT_IN_PLACE(recvbuf);
*ierr = MPI_Scatter(sendbuf, *sendcount, get_datatype(*sendtype),
recvbuf, *recvcount, get_datatype(*recvtype), *root, get_comm(*comm));
}
void mpi_scatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype,
void* recvbuf, int* recvcount, int* recvtype,
int* root, int* comm, int* ierr) {
- recvbuf = (char *) F2C_IN_PLACE(recvbuf);
+ recvbuf = (char *) FORT_IN_PLACE(recvbuf);
*ierr = MPI_Scatterv(sendbuf, sendcounts, displs, get_datatype(*sendtype),
recvbuf, *recvcount, get_datatype(*recvtype), *root, get_comm(*comm));
}
void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype,
void* recvbuf, int* recvcount, int* recvtype,
int* root, int* comm, int* ierr) {
- sendbuf = (char *) F2C_IN_PLACE(sendbuf);
- sendbuf = (char *) F2C_BOTTOM(sendbuf);
- recvbuf = (char *) F2C_BOTTOM(recvbuf);
+ sendbuf = (char *) FORT_IN_PLACE(sendbuf);
+ sendbuf = (char *) FORT_BOTTOM(sendbuf);
+ recvbuf = (char *) FORT_BOTTOM(recvbuf);
*ierr = MPI_Gather(sendbuf, *sendcount, get_datatype(*sendtype),
recvbuf, *recvcount, get_datatype(*recvtype), *root, get_comm(*comm));
}
void mpi_gatherv_(void* sendbuf, int* sendcount, int* sendtype,
void* recvbuf, int* recvcounts, int* displs, int* recvtype,
int* root, int* comm, int* ierr) {
- sendbuf = (char *) F2C_IN_PLACE(sendbuf);
- sendbuf = (char *) F2C_BOTTOM(sendbuf);
- recvbuf = (char *) F2C_BOTTOM(recvbuf);
+ sendbuf = (char *) FORT_IN_PLACE(sendbuf);
+ sendbuf = (char *) FORT_BOTTOM(sendbuf);
+ recvbuf = (char *) FORT_BOTTOM(recvbuf);
*ierr = MPI_Gatherv(sendbuf, *sendcount, get_datatype(*sendtype),
recvbuf, recvcounts, displs, get_datatype(*recvtype), *root, get_comm(*comm));
}
void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype,
void* recvbuf, int* recvcount, int* recvtype,
int* comm, int* ierr) {
- sendbuf = (char *) F2C_IN_PLACE(sendbuf);
+ sendbuf = (char *) FORT_IN_PLACE(sendbuf);
*ierr = MPI_Allgather(sendbuf, *sendcount, get_datatype(*sendtype),
recvbuf, *recvcount, get_datatype(*recvtype), get_comm(*comm));
}
void mpi_allgatherv_(void* sendbuf, int* sendcount, int* sendtype,
void* recvbuf, int* recvcounts,int* displs, int* recvtype,
int* comm, int* ierr) {
- sendbuf = (char *) F2C_IN_PLACE(sendbuf);
+ sendbuf = (char *) FORT_IN_PLACE(sendbuf);
*ierr = MPI_Allgatherv(sendbuf, *sendcount, get_datatype(*sendtype),
recvbuf, recvcounts, displs, get_datatype(*recvtype), get_comm(*comm));
}
void mpi_test_ (int * request, int *flag, MPI_Status * status, int* ierr){
MPI_Request req = find_request(*request);
- *ierr= MPI_Test(&req, flag, F2C_STATUS_IGNORE(status));
+ *ierr= MPI_Test(&req, flag, FORT_STATUS_IGNORE(status));
if(req==MPI_REQUEST_NULL){
free_request(*request);
*request=MPI_FORTRAN_REQUEST_NULL;
for(i = 0; i < *count; i++) {
reqs[i] = find_request(requests[i]);
}
- *ierr= MPI_Testall(*count, reqs, flag, F2C_STATUSES_IGNORE(statuses));
+ *ierr= MPI_Testall(*count, reqs, flag, FORT_STATUSES_IGNORE(statuses));
for(i = 0; i < *count; i++) {
if(reqs[i]==MPI_REQUEST_NULL){
free_request(requests[i]);
}
void mpi_get_count_(MPI_Status * status, int* datatype, int *count, int* ierr){
- *ierr = MPI_Get_count(F2C_STATUS_IGNORE(status), get_datatype(*datatype), count);
+ *ierr = MPI_Get_count(FORT_STATUS_IGNORE(status), get_datatype(*datatype), count);
}
void mpi_attr_get_(int* comm, int* keyval, void* attr_value, int* flag, int* ierr ){
new_op(MPI_BOR);
new_op(MPI_BXOR);
}
- /* smpif2c is responsible for generating a call with the final arguments */
+
*ierr = MPI_Init_thread(NULL, NULL,*required, provided);
}
{
*ierr = MPI_Sendrecv_replace(buf, *count, get_datatype(*datatype), *dst, *sendtag, *src,
- *recvtag, get_comm(*comm), F2C_STATUS_IGNORE(status));
+ *recvtag, get_comm(*comm), FORT_STATUS_IGNORE(status));
}
void mpi_testany_ (int* count, int* requests, int *index, int *flag, MPI_Status* status, int* ierr)
for(i = 0; i < *count; i++) {
reqs[i] = find_request(requests[i]);
}
- *ierr = MPI_Testany(*count, reqs, index, flag, F2C_STATUS_IGNORE(status));
+ *ierr = MPI_Testany(*count, reqs, index, flag, FORT_STATUS_IGNORE(status));
if(*index!=MPI_UNDEFINED)
if(reqs[*index]==MPI_REQUEST_NULL){
free_request(requests[*index]);
void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm, int* ierr)
{
- sendbuf = (char *) F2C_IN_PLACE(sendbuf);
+ sendbuf = (char *) FORT_IN_PLACE(sendbuf);
*ierr = MPI_Reduce_scatter_block(sendbuf, recvbuf, *recvcount, get_datatype(*datatype), get_op(*op), get_comm(*comm));
}
reqs[i] = find_request(requests[i]);
indices[i]=0;
}
- *ierr = MPI_Testsome(*incount, reqs, outcount, indices, F2C_STATUSES_IGNORE(statuses));
+ *ierr = MPI_Testsome(*incount, reqs, outcount, indices, FORT_STATUSES_IGNORE(statuses));
for(i=0;i<*incount;i++){
if(indices[i]){
if(reqs[indices[i]]==MPI_REQUEST_NULL){
}
void mpi_probe_ (int* source, int* tag, int* comm, MPI_Status* status, int* ierr) {
- *ierr = MPI_Probe(*source, *tag, get_comm(*comm), F2C_STATUS_IGNORE(status));
+ *ierr = MPI_Probe(*source, *tag, get_comm(*comm), FORT_STATUS_IGNORE(status));
}
void mpi_attr_delete_ (int* comm, int* keyval, int* ierr) {
int rank = atoi((*argv)[2]);
index = SIMIX_process_get_PID(proc) -1;
-#ifdef SMPI_F2C
- smpi_current_rank = index;
-#endif
if(!index_to_process_data){
index_to_process_data=(int*)xbt_malloc(SIMIX_process_count()*sizeof(int));
}
}
-#ifdef SMPI_F2C
-int smpi_process_argc(void)
-{
- smpi_process_data_t data = smpi_process_data();
- return data->argc ? *(data->argc) - 1 : 0;
-}
-
-int smpi_process_getarg(integer * index, char *dst, ftnlen len)
-{
- smpi_process_data_t data = smpi_process_data();
- char *arg;
- ftnlen i;
-
- if (!data->argc || !data->argv || *index < 1 || *index >= *(data->argc)) {
- return -1;
- }
- arg = (*data->argv)[*index];
- for (i = 0; i < len && arg[i] != '\0'; i++) {
- dst[i] = arg[i];
- }
- for (; i < len; i++) {
- dst[i] = ' ';
- }
- return 0;
-}
-#endif
-
int smpi_global_size(void)
{
char *value = getenv("SMPI_GLOBAL_SIZE");
smpi_free_static();
}
-/* Fortran specific stuff */
-/* With smpicc, the following weak symbols are used */
-/* With smpiff, the following weak symbols are replaced by those in libf2c */
-int __attribute__ ((weak)) xargc;
-char ** __attribute__ ((weak)) xargv;
-
#ifndef WIN32
void __attribute__ ((weak)) user_main_()
{
return smpi_main(smpi_simulated_main_, argc, argv);
}
-int __attribute__ ((weak)) MAIN__()
-{
- return smpi_main(smpi_simulated_main_, xargc, xargv);
-};
#endif
static void smpi_init_logs(){
+++ /dev/null
-#! /usr/bin/env perl
-
-# Copyright (c) 2010-2014. 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.
-
-use warnings;
-use strict;
-use File::Temp;
-use File::Copy;
-
-my $include="@includeflag@@f2cflags@";
-
-foreach my $fortran (@ARGV) {
- my $output = $fortran;
- $output =~ s/.f$/.c/;
-
- #print "F2C INPUT : ".$fortran."\n";
- #print "F2C OUTPUT: ".$output."\n";
-
- my$outputdir = $output;
- $outputdir=~s/[^\/]*\.c$//g;
- #print "F2C DIR : ".$outputdir."\n";
-
- my $tmp = new File::Temp;
- $tmp->autoflush(1);
- #print "f2c -d$outputdir $include -w -a $fortran\n";
- `f2c -d$outputdir $include -w -a $fortran`;
- die "F2C failed\n" if $?;
- open F2C,"<$output" or die "Unable to open file $output";
- my $started = 0;
- print $tmp "#ifndef INTEGER_STAR_8\n";
- print $tmp "#define INTEGER_STAR_8\n";
- print $tmp "#endif\n";
- print $tmp "#include <stdlib.h>\n";
- print $tmp "#include <smpif.h>\n";
- while(<F2C>) {
- chomp;
- if(/\/\* Common Block Declarations \*\//) {
- $started = 1;
- }
- if($started) {
- if(/^} (.*?);/) {
- $_ = "}* __attribute__((weak)) $1 = NULL;\n";
- } elsif(/^#define\s*(\S*)\s*\(?([^.]*)(\..*?)?\)?$/) {
- $_ = "#define $1 $2\[smpi_current_rank\]";
- if(defined $3) {
- $_ .= $3;
- }
- $_ .= "\n";
- $_ .= "\nvoid __attribute__((weak,constructor)) __preinit_$1(void) {\n if(!$2) $2 = malloc(smpi_global_size() * sizeof(*$2));\n}\n";
- $_ .= "\nvoid __attribute__((weak,destructor)) __postfini_$1(void) {\n free($2);\n $2 = NULL;\n}\n";
- }
- }
- if(/\/\* Table of constant values \*\// || /MAIN__/) {
- $started = 0;
- }
- $_ =~ s/(mpi_[\w]*_)_/$1/g;
- if(/\/* Main program alias \*\/\s*int\s+.*\s*\(\s*\)\s*{(.*)}/) {
- $_ = "int smpi_simulated_main_(int argc, char** argv) { smpi_process_init(&argc, &argv); $1 }\n";
- }
- print $tmp "$_\n";
- }
- close F2C;
- copy($tmp->filename,$output) or die "Copy failed: $!\n";
-}
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F2C)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F90)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F90)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F90)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F90)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()
cmake_minimum_required(VERSION 2.6)
-if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_F90)
+if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
if(WIN32)
set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
else()