else()
set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
endif()
+
+# include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
+# foreach(x struct vector)
+# add_executable (${x}/${x} ${x}/${x}.c)
+# target_link_libraries(${x}/ ${x} simgrid)
+#
+# set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
+# set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
+#
+# ADD_TESH_FACTORIES(tesh-smpi-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/${x} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/${x} ${x}.tesh)
+# endforeach()
+
endif()
-set(bin_files
- ${bin_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/hostfile
- ${CMAKE_CURRENT_SOURCE_DIR}/hostfile_coll
- PARENT_SCOPE)
+set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/hostfile
+ ${CMAKE_CURRENT_SOURCE_DIR}/hostfile_coll PARENT_SCOPE)
+# set(teshsuite_src ${teshsuite_src} PARENT_SCOPE)
+# set(tesh_files ${tesh_files} PARENT_SCOPE)
if(NOT WIN32)
add_executable (shared shared.c)
target_link_libraries(shared simgrid)
+ ADD_TESH_FACTORIES(tesh-smpi-shared "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/shared --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared shared.tesh)
endif()
endif()
-set(tesh_files
- ${tesh_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/shared.tesh
- PARENT_SCOPE)
-set(examples_src
- ${examples_src}
- ${CMAKE_CURRENT_SOURCE_DIR}/shared.c
- PARENT_SCOPE)
+set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/shared.tesh PARENT_SCOPE)
+set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/shared.c PARENT_SCOPE)
#include <stdint.h>
#include <inttypes.h>
-void* hash(char *str, uint64_t* ans);
-
-void* hash(char *str, uint64_t* ans)
+static void* hash(char *str, uint64_t* ans)
{
*ans=5381;
int c;
return NULL;
}
-
int main(int argc, char *argv[])
{
MPI_Init(&argc, &argv);
uint64_t* buf = SMPI_SHARED_MALLOC(sizeof(uint64_t));
//one writes data in it
if(rank==0){
- *buf=size;
+ *buf=size;
}
-
+
MPI_Barrier(MPI_COMM_WORLD);
//everyone reads from it.
printf("[%d] The value in the shared buffer is: %" PRIu64"\n", rank, *buf);
-
-
+
MPI_Barrier(MPI_COMM_WORLD);
//Try SMPI_SHARED_CALL function, which should call hash only once and for all.
char *str = strdup("onceandforall");
if(rank==size-1){
SMPI_SHARED_CALL(hash,str,str,buf);
}
-
+
MPI_Barrier(MPI_COMM_WORLD);
-
+
printf("[%d] After change, the value in the shared buffer is: %" PRIu64"\n", rank, *buf);
-
- SMPI_SHARED_FREE(buf);
- buf=NULL;
+
+ SMPI_SHARED_FREE(buf);
+ buf=NULL;
free(str);
-
+
MPI_Finalize();
return 0;
}
add_executable (struct_test struct_test.c)
target_link_libraries(struct_test simgrid)
+
+ ADD_TESH_FACTORIES(tesh-smpi-struct "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/struct --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct struct.tesh)
endif()
-set(tesh_files
- ${tesh_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/struct.tesh
- PARENT_SCOPE)
-set(examples_src
- ${examples_src}
- ${CMAKE_CURRENT_SOURCE_DIR}/struct_test.c
- PARENT_SCOPE)
+set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/struct.tesh PARENT_SCOPE)
+set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/struct_test.c PARENT_SCOPE)
#include <stdio.h>
#include "mpi.h"
-int main( argc, argv )
-int argc;
-char **argv;
+int main(int argc, char **argv)
{
int rank;
struct { int a;int c; double b;int tab[2][3];} value;
MPI_Bcast( &value, 1, mystruct, 0, MPI_COMM_WORLD );
printf( "Process %d got %d (-2?) and %f (8.0?), tab (should be all 0): ", rank, value.a, value.b );
-
+
for(j=0; j<2;j++ )
for(i=0; i<3;i++ )
printf("%d ", tab[j][i]);
-
printf("\n");
-
/* Clean up the type */
MPI_Type_free( &mystruct );
MPI_Type_free( &type2 );
add_executable (vector_test vector_test.c)
target_link_libraries(vector_test simgrid)
+
+ ADD_TESH_FACTORIES(tesh-smpi-vector "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/vector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/vector vector.tesh)
endif()
-set(tesh_files
- ${tesh_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/vector.tesh
- PARENT_SCOPE)
-set(examples_src
- ${examples_src}
- ${CMAKE_CURRENT_SOURCE_DIR}/vector_test.c
- PARENT_SCOPE)
+set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/vector.tesh PARENT_SCOPE)
+set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/vector_test.c PARENT_SCOPE)
#define SIZE 4
int main(int argc, char **argv) {
-
int rank, i, j;
double a[SIZE][SIZE] = {{0}};
MPI_Type_vector(SIZE, 1, SIZE, MPI_DOUBLE, &columntype);
MPI_Type_commit(&columntype);
-
if (rank == 0) {
for(i=0; i <SIZE;i++)
for(j=0; j <SIZE;j++)
a[i][j] = i*SIZE+j;
}
- /* only one column is send
- * this is an exemple for non-contignous data*/
+ /* only one column is send this is an exemple for non-contignous data*/
MPI_Bcast(a, 1, columntype, 0, MPI_COMM_WORLD);
for(i=0; i<SIZE; i++){
for (j=0; j < SIZE; j++) {
- printf("rank= %d, a[%d][%d]=%f\n",
- rank, i, j, a[i][j]);
+ printf("rank= %d, a[%d][%d]=%f\n", rank, i, j, a[i][j]);
}
printf("\n");
}
-
MPI_Type_free(&columntype);
MPI_Finalize();
return 0;
}
-
-
IF(enable_memcheck)
include(FindValgrind)
ENDIF()
ENDIF()
ENDIF()
-
### SIMIX ###
# BEGIN TESH TESTS
IF(HAVE_RAW_CONTEXTS)
ADD_TESH_FACTORIES(tesh-smpi-pt2pt "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong pt2pt.tesh)
ADD_TESH_FACTORIES(tesh-smpi-bcast "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/bcast --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/bcast bcast.tesh)
ADD_TESH_FACTORIES(tesh-smpi-reduce "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/reduce --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/reduce reduce.tesh)
- ADD_TESH_FACTORIES(tesh-smpi-vector "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/vector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/vector vector.tesh)
ADD_TESH_FACTORIES(tesh-smpi-hvector "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/hvector --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hvector hvector.tesh)
ADD_TESH_FACTORIES(tesh-smpi-indexed "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/indexed --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/indexed indexed.tesh)
- ADD_TESH_FACTORIES(tesh-smpi-struct "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/struct --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct struct.tesh)
ADD_TESH_FACTORIES(tesh-smpi-compute "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/compute --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute compute.tesh)
- IF(NOT WIN32)
- ADD_TESH_FACTORIES(tesh-smpi-shared "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/shared --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared shared.tesh)
- ENDIF()
# smpi broken usage
ADD_TESH_FACTORIES(tesh-smpi-broken "thread" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong broken_hostfiles.tesh)
ADD_TESH(tesh-smpi-replay-ti-tracing --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong TI_output.tesh)