From: navarro Date: Wed, 24 Oct 2012 20:03:53 +0000 (-0700) Subject: Compilation fix on SMPI with WIN32 X-Git-Tag: v3_9_rc1~91^2~218^2~3 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b8dc4761bddf2c38643048a549e7d8cc2bf722d5?hp=2e54bf19d3fefb2bd6fbaba11fff0ea3e6f82f0e;ds=sidebyside Compilation fix on SMPI with WIN32 --- diff --git a/examples/smpi/CMakeLists.txt b/examples/smpi/CMakeLists.txt index eaeb8d03c8..70df6b0d19 100644 --- a/examples/smpi/CMakeLists.txt +++ b/examples/smpi/CMakeLists.txt @@ -1,7 +1,11 @@ cmake_minimum_required(VERSION 2.6) if(enable_smpi) - set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/bin/smpicc") + if(WIN32) + set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h") + else(WIN32) + set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/bin/smpicc") + endif(WIN32) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/examples/smpi/MM/CMakeLists.txt b/examples/smpi/MM/CMakeLists.txt index af62a30ab1..e4ea2c248f 100644 --- a/examples/smpi/MM/CMakeLists.txt +++ b/examples/smpi/MM/CMakeLists.txt @@ -2,19 +2,16 @@ cmake_minimum_required(VERSION 2.6) if(enable_smpi) set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/bin/smpicc") - set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") -add_executable(MM_mpi MM_mpi.c 2.5D_MM.c Summa.c Matrix_init.c) - -### Add definitions for compile -if(NOT WIN32) - target_link_libraries(MM_mpi simgrid pthread m smpi) -else() - target_link_libraries(MM_mpi simgrid smpi) -endif() + if(NOT WIN32) + add_executable(MM_mpi MM_mpi.c 2.5D_MM.c Summa.c Matrix_init.c) + ### Add definitions for compile + target_link_libraries(MM_mpi simgrid pthread m smpi) + else() + target_link_libraries(MM_mpi simgrid smpi) + endif() endif() set(tesh_files diff --git a/examples/smpi/MM/MM_mpi.c b/examples/smpi/MM/MM_mpi.c index df0b9bcc4d..d112cdea18 100644 --- a/examples/smpi/MM/MM_mpi.c +++ b/examples/smpi/MM/MM_mpi.c @@ -11,11 +11,11 @@ /*int sched_setaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask); int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask); */ +#include +#include #include #include #include -#include -#include XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi, "Messages specific for this msg example"); diff --git a/examples/smpi/NAS/MPI_dummy/mpi_dummy.c b/examples/smpi/NAS/MPI_dummy/mpi_dummy.c index d2cbfb84bc..4cb7f06e63 100644 --- a/examples/smpi/NAS/MPI_dummy/mpi_dummy.c +++ b/examples/smpi/NAS/MPI_dummy/mpi_dummy.c @@ -1,8 +1,6 @@ +#include #include "mpi.h" #include "wtime.h" -#include - - void mpi_error( void ) { diff --git a/examples/smpi/bcbench.c b/examples/smpi/bcbench.c index 75defac0eb..5cd2f64280 100644 --- a/examples/smpi/bcbench.c +++ b/examples/smpi/bcbench.c @@ -8,6 +8,11 @@ #include #include +#ifdef _WIN32 + #define srandom srand + #define random rand +#endif + #define GETTIMEOFDAY_ERROR 1 #define N_START 1 diff --git a/examples/smpi/replay/replay.c b/examples/smpi/replay/replay.c index 3aad3c2b52..f508f9d958 100644 --- a/examples/smpi/replay/replay.c +++ b/examples/smpi/replay/replay.c @@ -4,6 +4,7 @@ /* 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 #include "smpi/smpi.h" int main(int argc, char *argv[]) diff --git a/examples/smpi/tracing/smpi_traced.c b/examples/smpi/tracing/smpi_traced.c index f23bb7b8fa..6c9e8febde 100644 --- a/examples/smpi/tracing/smpi_traced.c +++ b/examples/smpi/tracing/smpi_traced.c @@ -4,8 +4,8 @@ /* 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 "mpi.h" #include +#include "mpi.h" #include "instr/instr.h" #define DATATOSENT 100000 diff --git a/examples/smpi/tracing/smpi_traced_simple.c b/examples/smpi/tracing/smpi_traced_simple.c index 1de11155f5..ff92c0e3f9 100644 --- a/examples/smpi/tracing/smpi_traced_simple.c +++ b/examples/smpi/tracing/smpi_traced_simple.c @@ -3,8 +3,9 @@ /* 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 + #include +#include int main(int argc, char *argv[]) { diff --git a/src/smpi/smpicc.in b/src/smpi/smpicc.in index a1d1de1d54..c5627b37ac 100755 --- a/src/smpi/smpicc.in +++ b/src/smpi/smpicc.in @@ -1,11 +1,17 @@ #! /bin/bash CC=@CMAKE_C_COMPILER@ -CFLAGS="-O2 -Dmain=smpi_simulated_main" -INCLUDEARGS="-I@includedir@ -I@includedir@/smpi" +INCLUDEARGS="-I@includedir@ -I@includedir@/smpi -I@CMAKE_BINARY_DIR@/include" CMAKE_LINKARGS="-L@CMAKE_LINKARGS@" + +if [ @WIN32@ != 1 ]; then LINKARGS="-lsimgrid -lsmpi -lm" +CFLAGS="-O2 -Dmain=smpi_simulated_main" +else +CFLAGS="-O2 -include @includedir@/smpi/smpi_main.h" +LINKARGS="@CMAKE_BINARY_DIR@\lib\libsimgrid.dll @CMAKE_BINARY_DIR@\lib\libsmpi.dll" +fi CMDLINE="" while [ -n "$1" ]; do diff --git a/teshsuite/smpi/CMakeLists.txt b/teshsuite/smpi/CMakeLists.txt index 6d9731a6d5..0396a4a2ba 100644 --- a/teshsuite/smpi/CMakeLists.txt +++ b/teshsuite/smpi/CMakeLists.txt @@ -1,10 +1,14 @@ cmake_minimum_required(VERSION 2.6) if(enable_smpi) - set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/bin/smpicc") - + if(WIN32) + set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h") + else(WIN32) + set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/bin/smpicc") + endif(WIN32) + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - + include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(alltoall2 alltoall2.c ) @@ -19,7 +23,6 @@ if(enable_smpi) add_executable(scatter scatter.c) add_executable(reduce reduce.c) add_executable(split split.c) - add_executable(dsend dsend.c) add_executable(smpi_sendrecv sendrecv.c) add_executable(ttest01 ttest01.c) add_executable(vector_test vector_test.c) @@ -39,7 +42,6 @@ if(enable_smpi) target_link_libraries(scatter m simgrid smpi ) target_link_libraries(reduce m simgrid smpi ) target_link_libraries(split m simgrid smpi ) - target_link_libraries(dsend m simgrid smpi ) target_link_libraries(smpi_sendrecv m simgrid smpi ) target_link_libraries(ttest01 m simgrid smpi ) target_link_libraries(vector_test m simgrid smpi ) @@ -48,8 +50,15 @@ if(enable_smpi) target_link_libraries(struct_test m simgrid smpi ) set_target_properties(smpi_sendrecv PROPERTIES RENAME sendrecv) + + if(NOT WIN32) + add_executable(dsend dsend.c) + target_link_libraries(dsend m simgrid smpi ) + endif() + endif() + set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/bcast.tesh diff --git a/teshsuite/smpi/alltoall2.c b/teshsuite/smpi/alltoall2.c index ef2068e0a7..34e5912f17 100644 --- a/teshsuite/smpi/alltoall2.c +++ b/teshsuite/smpi/alltoall2.c @@ -34,12 +34,11 @@ **************************************************************************** */ -#include "mpi.h" #include #include #include #include - +#include "mpi.h" #define MAXLEN 10000 diff --git a/teshsuite/smpi/alltoall_basic.c b/teshsuite/smpi/alltoall_basic.c index 485752e2ef..ad25e7a24c 100644 --- a/teshsuite/smpi/alltoall_basic.c +++ b/teshsuite/smpi/alltoall_basic.c @@ -4,11 +4,11 @@ /* 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 "mpi.h" #include #include #include #include +#include "mpi.h" #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 diff --git a/teshsuite/smpi/alltoallv.c b/teshsuite/smpi/alltoallv.c index 492db4e072..f2717b9c56 100644 --- a/teshsuite/smpi/alltoallv.c +++ b/teshsuite/smpi/alltoallv.c @@ -3,11 +3,11 @@ * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ -#include "mpi.h" #include #include #include +#include "mpi.h" /* This program tests MPI_Alltoallv by having processor i send different diff --git a/teshsuite/smpi/indexed_test.c b/teshsuite/smpi/indexed_test.c index e557575b6f..3afb4402ce 100644 --- a/teshsuite/smpi/indexed_test.c +++ b/teshsuite/smpi/indexed_test.c @@ -1,5 +1,5 @@ -#include "mpi.h" #include +#include "mpi.h" int main(int argc, char *argv[]) { diff --git a/teshsuite/smpi/sendrecv.c b/teshsuite/smpi/sendrecv.c index ae9e297194..1e4962dfcd 100644 --- a/teshsuite/smpi/sendrecv.c +++ b/teshsuite/smpi/sendrecv.c @@ -4,8 +4,8 @@ /* 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 "mpi.h" #include +#include "mpi.h" static int test(int myid, int numprocs) { diff --git a/teshsuite/smpi/ttest01.c b/teshsuite/smpi/ttest01.c index ada55b9ea0..981d2a26b6 100644 --- a/teshsuite/smpi/ttest01.c +++ b/teshsuite/smpi/ttest01.c @@ -4,8 +4,8 @@ /* 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 "mpi.h" #include +#include "mpi.h" #include "instr/instr.h" #define DATATOSENT 100000000