In order to use ucontext with windows platform we had those files :
src/xbt/win32_ucontext.c
- include/xbt/win32_ucontext.h
+ src/include/xbt/win32_ucontext.h
Their copyright is the following:
# END TESH TESTS
if(enable_smpi_MPICH3_testsuite)
- ADD_TEST(smpi-mpich3-coll-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:thread)
- ADD_TEST(smpi-mpich3-coll-ompi-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0)
- ADD_TEST(smpi-mpich3-coll-mpich-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:mpich)
+ ADD_TEST(smpi-mpich3-coll-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatize_global_variables:yes)
+ ADD_TEST(smpi-mpich3-coll-ompi-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0 -execarg=--cfg=smpi/privatize_global_variables:yes)
+ ADD_TEST(smpi-mpich3-coll-mpich-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatize_global_variables:yes)
set_tests_properties(smpi-mpich3-coll-thread smpi-mpich3-coll-ompi-thread smpi-mpich3-coll-mpich-thread PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
if(CONTEXT_UCONTEXT)
- ADD_TEST(smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0)
+ ADD_TEST(smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0 -execarg=--cfg=smpi/privatize_global_variables:yes)
set_tests_properties(smpi-mpich3-coll-ompi-ucontext PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
if(HAVE_RAWCTX)
- ADD_TEST(smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich)
+ ADD_TEST(smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll 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/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatize_global_variables:yes)
set_tests_properties(smpi-mpich3-coll-mpich-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
endif()
if(SMPI_F2C)
- ADD_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/factory:thread -execarg=--cfg=contexts/stack_size:8000)
+ ADD_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(smpi-mpich3-thread-f77 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
if(SMPI_F90)
- ADD_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=contexts/factory:thread)
+ ADD_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(smpi-mpich3-thread-f90 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
endif()
message(STATUS "Warning: support for model-checking has been disabled because HAVE_MMALLOC is false")
endif()
SET(HAVE_MC 0)
+ SET(HAVE_MMALLOC 0)
SET(MMALLOC_WANT_OVERRIDE_LEGACY 0)
endif()
if(WIN32)
if(ARCH_32_BITS)
- set(mcsc_flags "-D_XBT_WIN32 -D_I_X86_ -I${CMAKE_HOME_DIRECTORY}/include/xbt -I${CMAKE_HOME_DIRECTORY}/src/xbt")
+ set(mcsc_flags "-D_XBT_WIN32 -D_I_X86_ -I${CMAKE_HOME_DIRECTORY}/src/include/xbt -I${CMAKE_HOME_DIRECTORY}/src/xbt")
else()
- set(mcsc_flags "-D_XBT_WIN32 -D_AMD64_ -I${CMAKE_HOME_DIRECTORY}/include/xbt -I${CMAKE_HOME_DIRECTORY}/src/xbt")
+ set(mcsc_flags "-D_XBT_WIN32 -D_AMD64_ -I${CMAKE_HOME_DIRECTORY}/src/include/xbt -I${CMAKE_HOME_DIRECTORY}/src/xbt")
endif()
endif()
else()
set(makecontext_CPPFLAGS "-DTEST_makecontext -D_AMD64_")
endif()
- set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/include/xbt -I${CMAKE_HOME_DIRECTORY}/src/xbt")
+ set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${CMAKE_HOME_DIRECTORY}/src/include/xbt -I${CMAKE_HOME_DIRECTORY}/src/xbt")
endif()
file(REMOVE ${CMAKE_BINARY_DIR}/conftestval)
### define source packages
set(EXTRA_DIST
- include/xbt/win32_ucontext.h
src/bindings/java/MANIFEST.MF.in
src/include/instr/instr_interface.h
src/include/mc/datatypes.h
src/include/surf/surf_resource_lmm.h
src/include/surf/surfxml_parse_values.h
src/include/surf/trace_mgr.h
+ src/include/xbt/win32_ucontext.h
src/include/xbt/wine_dbghelp.h
src/include/xbt/xbt_os_time.h
src/msg/msg_mailbox.h
src/mc/mc_compare.c
src/mc/mc_dpor.c
src/mc/mc_global.c
- src/mc/mc_dwarf
+ src/mc/mc_dwarf.c
src/mc/mc_member.c
+ src/mc/mc_dwarf_attrnames.h
src/mc/mc_dwarf_expression.c
+ src/mc/mc_dwarf_tagnames.h
src/mc/mc_liveness.c
src/mc/mc_memory.c
src/mc/mc_private.h
COMMAND ${DOXYGEN_PATH}/doxygen Doxyfile
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_HOME_DIRECTORY}/doc/simgrid_modules.map
COMMAND ${CMAKE_COMMAND} -E echo "XX Javadoc pass"
- COMMAND ${JAVADOC_PATH}/javadoc -quiet -d ${CMAKE_HOME_DIRECTORY}/doc/html/javadoc/ ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/msg/*.java
+ COMMAND ${JAVADOC_PATH}/javadoc -quiet -d ${CMAKE_HOME_DIRECTORY}/doc/html/javadoc/ ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*.java ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*/*.java
WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc
)
swig_link_libraries(surf-java simgrid)
add_dependencies(simgrid-java surf-java)
+add_dependencies(simgrid-java_pre_jar surf-java)
/* Define to 1 if mmalloc is compiled in. */
#cmakedefine HAVE_MMALLOC @HAVE_MMALLOC@
+/* Define to 1 if mmap is available */
+#cmakedefine HAVE_MMAP @HAVE_MMAP@
+
/* Define to 1 if you have the `getdtablesize' function. */
#cmakedefine HAVE_GETDTABLESIZE @HAVE_GETDTABLESIZE@
#define _SURF_SURF_ROUTING_H
#include "xbt/lib.h"
-#include "simgrid/platf_interface.h"
+#include "simgrid/platf.h"
SG_BEGIN_DECL()
#ifndef MMALLOC_H
#define MMALLOC_H 1
+#include <simgrid_config.h>
+#ifdef HAVE_MMALLOC
+
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#else
#include "xbt/dynar.h"
#include "xbt/dict.h"
-#include "mc/datatypes.h"
/* Datatype representing a separate heap. The whole point of the mmalloc module
* is to allow several such heaps in the process. It thus works by redefining
struct s_mc_snapshot;
+typedef struct s_dw_type *dw_type_t;
+
int mmalloc_compare_heap(struct s_mc_snapshot* snapshot1, struct s_mc_snapshot* snapshot2, xbt_mheap_t heap1, xbt_mheap_t heap2);
int mmalloc_linear_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2);
int init_heap_information(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t to_ignore1, xbt_dynar_t to_ignore2);
size_t mmalloc_get_bytes_used(xbt_mheap_t);
ssize_t mmalloc_get_busy_size(xbt_mheap_t, void *ptr);
+#endif
#endif /* MMALLOC_H */
+++ /dev/null
-package org.simgrid.msg;
-
-public final class NativeLib {
- public static String getPath() {
- String prefix = "NATIVE";
- String os = System.getProperty("os.name");
- String arch = System.getProperty("os.arch");
-
- if (os.toLowerCase().startsWith("^win"))
- os = "Windows";
- else if (os.contains("OS X"))
- os = "Darwin";
-
- if (arch.matches("^i[3-6]86$"))
- arch = "x86";
- else if (arch.equalsIgnoreCase("amd64"))
- arch = "x86_64";
-
- os = os.replace(' ', '_');
- arch = arch.replace(' ', '_');
-
- return prefix + "/" + os + "/" + arch + "/";
- }
-
- public static void main(String[] args) {
- System.out.println(getPath());
- }
-}
/**
* Set the value of a variable of a VM.
*
- * @param host
+ * @param vm
* @param variable
* @param value
*/
#include "xbt/fifo.h"
#include "xbt/dict.h"
#include "xbt/function_types.h"
-#include "mc/datatypes.h"
#include "simgrid/simix.h"
#include "simgrid/modelchecker.h" /* our public interface (and definition of HAVE_MC) */
#include "xbt/automaton.h"
* @brief Open a file on a workstation
*
* @param workstation The surf workstation
- * @param mount The mount point
- * @param path The path to the file
+ * @param fullpath The path to the file
* @return The surf action corresponding to the openning
*/
XBT_PUBLIC(surf_action_t) surf_workstation_open(surf_resource_t workstation, const char* fullpath);
/** \ingroup msg_file_management
* \brief Opens the file whose name is the string pointed to by path
*
- * \param mount is the mount point where find the file is located
* \param fullpath is the file location on the storage
* \param data user data to attach to the file
*
xbt_cfgelm_int, 1, 1, NULL, NULL);
xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/send_is_detached_thres", 65536);
+ xbt_cfg_register(&_sg_cfg_set, "smpi/privatize_global_variables",
+ "Boolean indicating whether we should privatize global variable at runtime.",
+ xbt_cfgelm_boolean, 1, 1, NULL, NULL);
+ xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/privatize_global_variables", "no");
+
//For smpi/bw_factor and smpi/lat_factor
//Default value have to be "threshold0:value0;threshold1:value1;...;thresholdN:valueN"
//test is if( size >= thresholdN ) return valueN;
#include "mc/mc.h"
#ifdef _XBT_WIN32
-# include <win32_ucontext.h> /* context relative declarations */
+# include <xbt/win32_ucontext.h> /* context relative declarations */
#else
# include <ucontext.h> /* context relative declarations */
#endif
// utilities
extern double smpi_cpu_threshold;
extern double smpi_running_power;
+extern int smpi_privatize_global_variables;
+extern char* start_data_exe; //start of the data+bss segment of the executable
+extern int size_data_exe; //size of the data+bss segment of the executable
+
+
+void switch_data_segment(int);
+void smpi_get_executable_global_size(void);
+void smpi_initialize_global_memory_segments(void);
+void smpi_destroy_global_memory_segments(void);
void smpi_bench_destroy(void);
void smpi_bench_begin(void);
void smpi_bench_end(void);
+
// f77 wrappers
void mpi_init_(int*);
void mpi_finalize_(int*);
if(request->old_type->has_subtype == 0){
oldbuf = request->buf;
if (!_xbt_replay_is_active() && oldbuf && request->size!=0){
+ if((smpi_privatize_global_variables)
+ && ((char*)request->buf >= start_data_exe)
+ && ((char*)request->buf < start_data_exe + size_data_exe )
+ ){
+ XBT_WARN("Privatization : We are sending from a zone inside global memory. Switch data segment ");
+ switch_data_segment(smpi_process_index());
+ }
+
+
buf = xbt_malloc(request->size);
memcpy(buf,oldbuf,request->size);
}
MPI_Datatype datatype = req->old_type;
if(datatype->has_subtype == 1){
+ if (!_xbt_replay_is_active()){
+ if( smpi_privatize_global_variables
+ && ((char*)req->old_buf >= start_data_exe)
+ && ((char*)req->old_buf < start_data_exe + size_data_exe )
+ ){
+ XBT_VERB("Privatization : We are unserializing to a zone in global memory - Switch data segment ");
+ switch_data_segment(smpi_process_index());
+ }
+ }
// This part handles the problem of non-contignous memory
// the unserialization at the reception
s_smpi_subtype_t *subtype = datatype->substruct;
/* 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 "internal_config.h"
#include "private.h"
#include "xbt/dict.h"
#include "xbt/sysdep.h"
double smpi_cpu_threshold;
double smpi_running_power;
+int* fds;
+void** mappings;
+int loaded_page = -1;
+char* start_data_exe = NULL;
+int size_data_exe = 0;
+int smpi_privatize_global_variables;
+
typedef struct {
int fd;
int count;
}
}
+void switch_data_segment(int dest);
+
void smpi_bench_begin(void)
{
+ switch_data_segment(smpi_process_index());
xbt_os_threadtimer_start(smpi_process_timer());
smpi_current_rank = smpi_process_index();
}
{
xbt_os_timer_t timer = smpi_process_timer();
xbt_os_threadtimer_stop(timer);
+// switch_data_segment(smpi_process_count());
if (smpi_process_get_sampling()) {
XBT_CRITICAL("Cannot do recursive benchmarks.");
XBT_CRITICAL("Are you trying to make a call to MPI within a SMPI_SAMPLE_ block?");
free(loc);
return data;
}
+
+
+
+
+#ifndef WIN32
+#define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
+
+
+/*
+ * - read the executable data+bss section addresses and sizes
+ * - for each process create a copy of these sections with mmap
+ * - store them in a dynar
+ *
+ */
+
+
+
+void switch_data_segment(int dest){
+
+ if(size_data_exe == 0)//no need to switch
+ return;
+
+ if (loaded_page==dest)//no need to switch either
+ return;
+#ifdef HAVE_MMAP
+ int current= fds[dest];
+ XBT_VERB("Switching data frame to the one of process %d", dest);
+ void* tmp = mmap (TOPAGE(start_data_exe), size_data_exe, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, current, 0);
+ msync(TOPAGE(start_data_exe), size_data_exe, MS_SYNC | MS_INVALIDATE );
+ if (tmp != TOPAGE(start_data_exe))
+ xbt_die("Couldn't map the new region");
+ loaded_page=dest;
+#endif
+}
+
+void smpi_get_executable_global_size(){
+ int size_bss_binary=0;
+ int size_data_binary=0;
+ FILE *fp;
+ char *line = NULL; /* Temporal storage for each line that is readed */
+ ssize_t read; /* Number of bytes readed */
+ size_t n = 0; /* Amount of bytes to read by xbt_getline */
+
+ char *lfields[7];
+ int i, found = 0;
+
+ char *command = bprintf("objdump --section-headers %s", xbt_binary_name);
+
+ fp = popen(command, "r");
+
+ if(fp == NULL){
+ perror("popen failed");
+ xbt_abort();
+ }
+
+ while ((read = xbt_getline(&line, &n, fp)) != -1 && found != 2) {
+
+ if(n == 0)
+ continue;
+
+ /* Wipeout the new line character */
+ line[read - 1] = '\0';
+
+ lfields[0] = strtok(line, " ");
+
+ if(lfields[0] == NULL)
+ continue;
+
+ if(strcmp(lfields[0], "Sections:") == 0
+ || strcmp(lfields[0], "Idx") == 0
+ || strncmp(lfields[0], xbt_binary_name, strlen(xbt_binary_name)) == 0)
+ continue;
+
+ for (i = 1; i < 7 && lfields[i - 1] != NULL; i++) {
+ lfields[i] = strtok(NULL, " ");
+ }
+
+ /*
+ * we are looking for these fields
+ 23 .data 02625a20 00000000006013e0 00000000006013e0 000013e0 2**5
+ CONTENTS, ALLOC, LOAD, DATA
+ 24 .bss 02625a40 0000000002c26e00 0000000002c26e00 02626e00 2**5
+ ALLOC
+ */
+
+ if(i>=6){
+ if(strcmp(lfields[1], ".data") == 0){
+ size_data_binary = strtoul(lfields[2], NULL, 16);
+ start_data_exe = (char*) strtoul(lfields[4], NULL, 16);
+ found++;
+ }else if(strcmp(lfields[1], ".bss") == 0){
+ //the beginning of bss is not exactly the end of data if not aligned, grow bss reported size accordingly
+ //TODO : check if this is OK, as some segments may be inserted between them..
+ size_bss_binary = ((char*) strtoul(lfields[4], NULL, 16) - (start_data_exe + size_data_binary))
+ + strtoul(lfields[2], NULL, 16);
+ found++;
+ }
+
+ }
+
+ }
+
+ size_data_exe =(unsigned long)start_data_exe - (unsigned long)TOPAGE(start_data_exe)+ size_data_binary+size_bss_binary;
+ xbt_free(command);
+ xbt_free(line);
+ pclose(fp);
+
+}
+
+void smpi_initialize_global_memory_segments(){
+
+#ifndef HAVE_MMAP
+ smpi_privatize_global_variables=0;
+ return;
+#else
+
+ unsigned int i = 0;
+ smpi_get_executable_global_size();
+
+ XBT_DEBUG ("bss+data segment found : size %d starting at %p",size_data_exe, start_data_exe );
+
+ if(size_data_exe == 0){//no need to switch
+ smpi_privatize_global_variables=0;
+ return;
+ }
+
+ fds= (int*)xbt_malloc((smpi_process_count())*sizeof(int));
+ mappings= (void**)xbt_malloc((smpi_process_count())*sizeof(void*));
+
+
+ for (i=0; i< SIMIX_process_count(); i++){
+ //create SIMIX_process_count() mappings of this size with the same data inside
+ void *address = NULL, *tmp = NULL;
+ char path[] = "/dev/shm/my-buffer-XXXXXX";
+ int status;
+ int file_descriptor= mkstemp (path);
+ if (file_descriptor < 0)
+ xbt_die("Impossible to create temporary file for memory mapping");
+ status = unlink (path);
+ if (status)
+ xbt_die("Impossible to unlink temporary file for memory mapping");
+
+ status = ftruncate(file_descriptor, size_data_exe);
+ if(status)
+ xbt_die("Impossible to set the size of the temporary file for memory mapping");
+
+ /* Ask for a free region */
+ address = mmap (NULL, size_data_exe, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+
+ if (address == MAP_FAILED)
+ xbt_die("Couldn't find a free region for memory mapping");
+
+ tmp = mmap (address, size_data_exe, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, file_descriptor, 0);
+
+ if (tmp != address)
+ xbt_die("Couldn't obtain the right address");
+ //initialize the values
+ memcpy(address,TOPAGE(start_data_exe),size_data_exe);
+
+ //store the address of the mapping for further switches
+ fds[i]=file_descriptor;
+ mappings[i]= address;
+ }
+
+#endif
+
+}
+
+void smpi_destroy_global_memory_segments(){
+ if(size_data_exe == 0)//no need to switch
+ return;
+#ifdef HAVE_MMAP
+ int i;
+ for (i=0; i< smpi_process_count(); i++){
+ if(munmap(mappings[i],size_data_exe) < 0) {
+ XBT_WARN("Unmapping of fd %d failed: %s", fds[i], strerror(errno));
+ }
+ close(fds[i]);
+ }
+ xbt_free(mappings);
+ xbt_free(fds);
+
+#endif
+
+}
+
+
+#endif
{
XBT_DEBUG("Copy the data over");
if(_xbt_replay_is_active()) return;
- memcpy(comm->comm.dst_buff, buff, buff_size);
+ void* tmpbuff=buff;
+
+ if((smpi_privatize_global_variables)
+ && ((char*)buff >= start_data_exe)
+ && ((char*)buff < start_data_exe + size_data_exe )
+ ){
+ XBT_WARN("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
+ switch_data_segment(((smpi_process_data_t)SIMIX_process_get_data(comm->comm.src_proc))->index);
+ tmpbuff = (void*)xbt_malloc(buff_size);
+ memcpy(tmpbuff, buff, buff_size);
+ }
+
+
+ if((smpi_privatize_global_variables)
+ && ((char*)comm->comm.dst_buff >= start_data_exe)
+ && ((char*)comm->comm.dst_buff < start_data_exe + size_data_exe )
+ ){
+ XBT_WARN("Privatization : We are copying to a zone inside global memory - Switch data segment");
+ switch_data_segment(((smpi_process_data_t)SIMIX_process_get_data(comm->comm.dst_proc))->index);
+ }
+
+
+ memcpy(comm->comm.dst_buff, tmpbuff, buff_size);
if (comm->comm.detached) {
// if this is a detached send, the source buffer was duplicated by SMPI
// sender to make the original buffer available to the application ASAP
//inside the user data and should be free
comm->comm.src_buff = NULL;
}
+
+ if(tmpbuff!=buff)xbt_free(tmpbuff);
+
}
void smpi_global_init(void)
"Use the option \"--cfg=smpi/running_power:<flops>\" to set its value."
"Check http://simgrid.org/simgrid/latest/doc/options.html#options_smpi_bench for more information. ");
}
+ if(smpi_privatize_global_variables)
+ smpi_initialize_global_memory_segments();
}
void smpi_global_destroy(void)
}
xbt_free(process_data);
process_data = NULL;
-
+ if(smpi_privatize_global_variables)
+ smpi_destroy_global_memory_segments();
smpi_free_static();
}
smpi_cpu_threshold = sg_cfg_get_double("smpi/cpu_threshold");
smpi_running_power = sg_cfg_get_double("smpi/running_power");
+ smpi_privatize_global_variables = sg_cfg_get_boolean("smpi/privatize_global_variables");
if (smpi_cpu_threshold < 0)
smpi_cpu_threshold = DBL_MAX;
void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
MPI_Datatype * datatype)
{
+ if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+ XBT_VERB("Applying operation, switch to the right data frame ");
+ switch_data_segment(smpi_process_index());
+ }
+
if(!_xbt_replay_is_active())
op->func(invec, inoutvec, len, datatype);
}
/**
* @brief Open a file
*
- * @param mount The mount point
- * @param path The full path to the file
+ * @param fullpath The full path to the file
*
* @return The StorageAction corresponding to the opening
*/
XBT_LOG_CONNECT(mc_checkpoint);
XBT_LOG_CONNECT(mc_compare);
XBT_LOG_CONNECT(mc_dpor);
+ XBT_LOG_CONNECT(mc_dwarf);
XBT_LOG_CONNECT(mc_global);
+ XBT_LOG_CONNECT(mc_hash);
XBT_LOG_CONNECT(mc_liveness);
XBT_LOG_CONNECT(mc_memory);
XBT_LOG_CONNECT(mc_memory_map);
add_executable(allpairf allpairf.f)
# add_executable(greqf greqf.f dummyf.f)
#add_executable(mprobef mprobef.f)
-# add_executable(statusesf statusesf.f)
+ add_executable(statusesf statusesf.f)
target_link_libraries(allpairf simgrid mtest_f77)
# target_link_libraries(greqf simgrid mtest_f77)
#target_link_libraries(mprobef simgrid mtest_f77)
-# target_link_libraries(statusesf simgrid mtest_f77)
+ target_link_libraries(statusesf simgrid mtest_f77)
endif()
-#statusesf 1
+statusesf 1
#greqf 1
allpairf 2
-#mprobef 2 mpiversion=3.0
+mprobef 2 mpiversion=3.0
logical dbgflag
integer wrank
common /mtest/ dbgflag, wrank
- integer myindex
- common /grr/ myindex
call MPI_Initialized( flag, ierr )
if (.not. flag) then
endif
dbgflag = .false.
- myindex = 0
call MPI_Comm_rank( MPI_COMM_WORLD, wrank, ierr )
end
C
integer comm, min_size, size, rank
logical qsmaller
integer myindex
- common /grr/ myindex
+ save myindex
+ data myindex /0/
comm = MPI_COMM_NULL
if (myindex .eq. 0) then
endif
myindex = mod( myindex, 4 ) + 1
MTestGetIntracomm = comm .ne. MPI_COMM_NULL
- qsmaller=.true.
end
C
subroutine MTestFreeComm( comm )
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
-# add_executable(allpairf90 allpairf90.f90)
+ add_executable(allpairf90 allpairf90.f90)
# add_executable(greqf90 greqf90.f90 dummyf90.f90)
# add_executable(mprobef90 mprobef90.f90)
add_executable(statusesf90 statusesf90.f90)
-# target_link_libraries(allpairf90 simgrid mtest_f90)
+ target_link_libraries(allpairf90 simgrid mtest_f90)
# target_link_libraries(greqf90 simgrid mtest_f90)
# target_link_libraries(mprobef90 simgrid mtest_f90)
target_link_libraries(statusesf90 simgrid mtest_f90)
call MTest_Init( ierr )
do while ( mtestGetIntraComm( comm, 2, .false. ) )
+
call test_pair_send( comm, errs )
call test_pair_ssend( comm, errs )
!call test_pair_rsend( comm, errs )
# This file generated by f77tof90
statusesf90 1
#greqf90 1
-#allpairf90 2
+allpairf90 2
mprobef90 2 mpiversion=3.0
endif
endif
end
-
-module array
- integer, dimension(:), allocatable :: myindex
-end module
-
!
! A simple get intracomm for now
logical function MTestGetIntracomm( comm, min_size, qsmaller )
- use array
use mpi
-
integer ierr
integer comm, min_size, size, rank
logical qsmaller
+ integer myindex
+ save myindex
+ data myindex /0/
- integer status
- call mpi_comm_size( MPI_COMM_WORLD, size, ierr )
-
- if(.not. allocated(myindex)) then
- allocate(myindex(size), STAT=status)
- call mpi_comm_rank( MPI_COMM_WORLD, rank, ierr )
- myindex(rank+1)=0
- endif
-
- !data myindex /0/
-
-
-
- if (myindex(rank+1) .eq. 0) then
+ comm = MPI_COMM_NULL
+ if (myindex .eq. 0) then
comm = MPI_COMM_WORLD
- else if (myindex(rank+1) .eq. 1) then
+ else if (myindex .eq. 1) then
call mpi_comm_dup( MPI_COMM_WORLD, comm, ierr )
- else if (myindex(rank+1) .eq. 2) then
+ else if (myindex .eq. 2) then
call mpi_comm_size( MPI_COMM_WORLD, size, ierr )
call mpi_comm_rank( MPI_COMM_WORLD, rank, ierr )
call mpi_comm_split( MPI_COMM_WORLD, 0, size - rank, comm, &
& ierr )
else
- if (min_size .eq. 1 .and. myindex(rank+1) .eq. 3) then
+ if (min_size .eq. 1 .and. myindex .eq. 3) then
comm = MPI_COMM_SELF
endif
endif
- myindex(rank+1) = mod( myindex(rank+1), 4 ) + 1
+ myindex = mod( myindex, 4 ) + 1
MTestGetIntracomm = comm .ne. MPI_COMM_NULL
- qsmaller=.true.
end
!
subroutine MTestFreeComm( comm )
#include "mpi.h"
#include "mpitestconf.h"
#include "mpitest.h"
-#include "smpi_cocci.h"
#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
#include <stdio.h>
#endif
/* Here is where we could put the includes and definitions to enable
memory testing */
-SMPI_VARINIT_GLOBAL_AND_SET(dbgflag, int, 0); /* Flag used for debugging */
-SMPI_VARINIT_GLOBAL_AND_SET(wrank, int, -1); /* World rank */
-SMPI_VARINIT_GLOBAL_AND_SET(verbose, int, 0); /* Message level (0 is none) */
-SMPI_VARINIT_GLOBAL_AND_SET(returnWithVal, int, 0); /* Allow programs to return
- with a non-zero if there was an error (may
- cause problems with some runtime systems) */
-SMPI_VARINIT_GLOBAL_AND_SET(usageOutput, int, 0); /* */
+static int dbgflag = 0; /* Flag used for debugging */
+static int wrank = -1; /* World rank */
+static int verbose = 0; /* Message level (0 is none) */
+static int returnWithVal = 0; /* Allow programs to return with a non-zero
+ if there was an error (may cause problems
+ with some runtime systems) */
+static int usageOutput = 0; /* */
/* Provide backward portability to MPI 1 */
#ifndef MPI_VERSION
}
/* Check for debugging control */
if (getenv( "MPITEST_DEBUG" )) {
- SMPI_VARGET_GLOBAL(dbgflag) = 1;
- MPI_Comm_rank( MPI_COMM_WORLD, &SMPI_VARGET_GLOBAL(wrank) );
+ dbgflag = 1;
+ MPI_Comm_rank( MPI_COMM_WORLD, &wrank );
}
/* Check for verbose control */
}
else {
if (val >= 0) {
- SMPI_VARGET_GLOBAL(verbose) = val;
+ verbose = val;
}
else {
fprintf( stderr, "Warning: %s not valid for MPITEST_VERBOSE\n",
strcmp( envval, "YES" ) == 0 ||
strcmp( envval, "true" ) == 0 ||
strcmp( envval, "TRUE" ) == 0) {
- SMPI_VARGET_GLOBAL(returnWithVal) = 1;
+ returnWithVal = 1;
}
else if (strcmp( envval, "no" ) == 0 ||
strcmp( envval, "NO" ) == 0 ||
strcmp( envval, "false" ) == 0 ||
strcmp( envval, "FALSE" ) == 0) {
- SMPI_VARGET_GLOBAL(returnWithVal) = 0;
+ returnWithVal = 0;
}
else {
fprintf( stderr,
/* Print rusage data if set */
if (getenv( "MPITEST_RUSAGE" )) {
- SMPI_VARGET_GLOBAL(usageOutput) = 1;
+ usageOutput = 1;
}
}
/*
fflush( stdout );
}
- if (SMPI_VARGET_GLOBAL(usageOutput))
+ if (usageOutput)
MTestResourceSummary( stdout );
*/
int MTestReturnValue( int errors )
{
- if (SMPI_VARGET_GLOBAL(returnWithVal)) return errors ? 1 : 0;
+ if (returnWithVal) return errors ? 1 : 0;
return 0;
}
/* ------------------------------------------------------------------------ */
* Indexed - Indexed datatype. Only for a count of 1 instance of the
* datatype
*/
-SMPI_VARINIT_GLOBAL_AND_SET(datatype_index, int, 0);
+static int datatype_index = 0;
/* ------------------------------------------------------------------------ */
/* Datatype routines for contiguous datatypes */
recvtype->count = count;
/* Use datatype_index to choose a datatype to use. If at the end of the
list, return 0 */
- switch (SMPI_VARGET_GLOBAL(datatype_index)) {
+ switch (datatype_index) {
case 0:
sendtype->datatype = MPI_INT;
sendtype->isBasic = 1;
break;
#endif
default:
- SMPI_VARGET_GLOBAL(datatype_index) = -1;
+ datatype_index = -1;
}
if (!sendtype->InitBuf) {
sendtype->CheckBuf = MTestTypeContigCheckbuf;
recvtype->CheckBuf = MTestTypeContigCheckbuf;
}
- SMPI_VARGET_GLOBAL(datatype_index)++;
+ datatype_index++;
- if (SMPI_VARGET_GLOBAL(dbgflag) && SMPI_VARGET_GLOBAL(datatype_index) > 0) {
+ if (dbgflag && datatype_index > 0) {
int typesize;
- fprintf( stderr, "%d: sendtype is %s\n", SMPI_VARGET_GLOBAL(wrank), MTestGetDatatypeName( sendtype ) );
+ fprintf( stderr, "%d: sendtype is %s\n", wrank, MTestGetDatatypeName( sendtype ) );
merr = MPI_Type_size( sendtype->datatype, &typesize );
if (merr) MTestPrintError( merr );
- fprintf( stderr, "%d: sendtype size = %d\n", SMPI_VARGET_GLOBAL(wrank), typesize );
- fprintf( stderr, "%d: recvtype is %s\n", SMPI_VARGET_GLOBAL(wrank), MTestGetDatatypeName( recvtype ) );
+ fprintf( stderr, "%d: sendtype size = %d\n", wrank, typesize );
+ fprintf( stderr, "%d: recvtype is %s\n", wrank, MTestGetDatatypeName( recvtype ) );
merr = MPI_Type_size( recvtype->datatype, &typesize );
if (merr) MTestPrintError( merr );
- fprintf( stderr, "%d: recvtype size = %d\n", SMPI_VARGET_GLOBAL(wrank), typesize );
+ fprintf( stderr, "%d: recvtype size = %d\n", wrank, typesize );
fflush( stderr );
}
- else if (SMPI_VARGET_GLOBAL(verbose) && SMPI_VARGET_GLOBAL(datatype_index) > 0) {
+ else if (verbose && datatype_index > 0) {
printf( "Get new datatypes: send = %s, recv = %s\n",
MTestGetDatatypeName( sendtype ),
MTestGetDatatypeName( recvtype ) );
fflush( stdout );
}
- return SMPI_VARGET_GLOBAL(datatype_index);
+ return datatype_index;
}
/* Reset the datatype index (start from the initial data type.
*/
void MTestResetDatatypes( void )
{
- SMPI_VARGET_GLOBAL(datatype_index) = 0;
+ datatype_index = 0;
}
/* Return the index of the current datatype. This is rarely needed and
is provided mostly to enable debugging of the MTest package itself */
int MTestGetDatatypeIndex( void )
{
- return SMPI_VARGET_GLOBAL(datatype_index);
+ return datatype_index;
}
/* Free the storage associated with a datatype */
simplify the use of the routine */
const char *MTestGetDatatypeName( MTestDatatype *dtype )
{
- typedef char name_type[4][MPI_MAX_OBJECT_NAME];
- SMPI_VARINIT_STATIC(name, name_type);
- SMPI_VARINIT_STATIC_AND_SET(sp, int, 0);
+ static char name[4][MPI_MAX_OBJECT_NAME];
+ static int sp=0;
int rlen, merr;
- if (SMPI_VARGET_STATIC(sp) >= 4) SMPI_VARGET_STATIC(sp) = 0;
- merr = MPI_Type_get_name( dtype->datatype, SMPI_VARGET_STATIC(name)[SMPI_VARGET_STATIC(sp)], &rlen );
+ if (sp >= 4) sp = 0;
+ merr = MPI_Type_get_name( dtype->datatype, name[sp], &rlen );
if (merr) MTestPrintError( merr );
- return (const char *)SMPI_VARGET_STATIC(name)[SMPI_VARGET_STATIC(sp)++];
+ return (const char *)name[sp++];
}
/* ----------------------------------------------------------------------- */
* that return value as well.
*
*/
-SMPI_VARINIT_GLOBAL_AND_SET(interCommIdx, int, 0);
-SMPI_VARINIT_GLOBAL_AND_SET(intraCommIdx, int, 0);
-SMPI_VARINIT_GLOBAL_AND_SET(intraCommName, const char *, 0);
-SMPI_VARINIT_GLOBAL_AND_SET(interCommName, const char *, 0);
+static int interCommIdx = 0;
+static int intraCommIdx = 0;
+static const char *intraCommName = 0;
+static const char *interCommName = 0;
/*
* Get an intracommunicator with at least min_size members. If "allowSmaller"
MPI_COMM_NULL is always considered large enough */
while (!done) {
isBasic = 0;
- SMPI_VARGET_GLOBAL(intraCommName) = "";
- switch (SMPI_VARGET_GLOBAL(intraCommIdx)) {
+ intraCommName = "";
+ switch (intraCommIdx) {
case 0:
*comm = MPI_COMM_WORLD;
isBasic = 1;
- SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_WORLD";
+ intraCommName = "MPI_COMM_WORLD";
break;
case 1:
/* dup of world */
merr = MPI_Comm_dup(MPI_COMM_WORLD, comm );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(intraCommName) = "Dup of MPI_COMM_WORLD";
+ intraCommName = "Dup of MPI_COMM_WORLD";
break;
case 2:
/* reverse ranks */
if (merr) MTestPrintError( merr );
merr = MPI_Comm_split( MPI_COMM_WORLD, 0, size-rank, comm );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(intraCommName) = "Rank reverse of MPI_COMM_WORLD";
+ intraCommName = "Rank reverse of MPI_COMM_WORLD";
break;
case 3:
/* subset of world, with reversed ranks */
merr = MPI_Comm_split( MPI_COMM_WORLD, ((rank < size/2) ? 1 : MPI_UNDEFINED),
size-rank, comm );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(intraCommName) = "Rank reverse of half of MPI_COMM_WORLD";
+ intraCommName = "Rank reverse of half of MPI_COMM_WORLD";
break;
case 4:
*comm = MPI_COMM_SELF;
isBasic = 1;
- SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_SELF";
+ intraCommName = "MPI_COMM_SELF";
break;
/* These next cases are communicators that include some
int newsize;
merr = MPI_Comm_size( MPI_COMM_WORLD, &size );
if (merr) MTestPrintError( merr );
- newsize = size - (SMPI_VARGET_GLOBAL(intraCommIdx) - 4);
+ newsize = size - (intraCommIdx - 4);
if (allowSmaller && newsize >= min_size) {
merr = MPI_Comm_rank( MPI_COMM_WORLD, &rank );
*comm = MPI_COMM_NULL;
}
else {
- SMPI_VARGET_GLOBAL(intraCommName) = "Split of WORLD";
+ intraCommName = "Split of WORLD";
}
}
else {
/* Act like default */
*comm = MPI_COMM_NULL;
- SMPI_VARGET_GLOBAL(intraCommIdx) = -1;
+ intraCommIdx = -1;
}
}
break;
/* Other ideas: dup of self, cart comm, graph comm */
default:
*comm = MPI_COMM_NULL;
- SMPI_VARGET_GLOBAL(intraCommIdx) = -1;
+ intraCommIdx = -1;
break;
}
done = 1;
}
else {
- SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_NULL";
+ intraCommName = "MPI_COMM_NULL";
isBasic = 1;
done = 1;
}
/* Advance the comm index whether we are done or not, otherwise we could
* spin forever trying to allocate a too-small communicator over and
* over again. */
- SMPI_VARGET_GLOBAL(intraCommIdx)++;
+ intraCommIdx++;
if (!done && !isBasic && *comm != MPI_COMM_NULL) {
/* avoid leaking communicators */
}
}
- return SMPI_VARGET_GLOBAL(intraCommIdx);
+ return intraCommIdx;
}
/*
/* Return the name of an intra communicator */
const char *MTestGetIntracommName( void )
{
- return SMPI_VARGET_GLOBAL(intraCommName);
+ return intraCommName;
}
/*
while (!done) {
*comm = MPI_COMM_NULL;
*isLeftGroup = 0;
- SMPI_VARGET_GLOBAL(interCommName) = "MPI_COMM_NULL";
+ interCommName = "MPI_COMM_NULL";
- switch (SMPI_VARGET_GLOBAL(interCommIdx)) {
+ switch (interCommIdx) {
case 0:
/* Split comm world in half */
merr = MPI_Comm_rank( MPI_COMM_WORLD, &rank );
merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD, rleader,
12345, comm );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD";
+ interCommName = "Intercomm by splitting MPI_COMM_WORLD";
}
else
*comm = MPI_COMM_NULL;
merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD,
rleader, 12346, comm );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD into 1, rest";
+ interCommName = "Intercomm by splitting MPI_COMM_WORLD into 1, rest";
}
else
*comm = MPI_COMM_NULL;
merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD,
rleader, 12347, comm );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD into 2, rest";
+ interCommName = "Intercomm by splitting MPI_COMM_WORLD into 2, rest";
}
else
*comm = MPI_COMM_NULL;
mcomm = *comm;
merr = MPI_Comm_dup(mcomm, comm);
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then dup'ing";
+ interCommName = "Intercomm by splitting MPI_COMM_WORLD then dup'ing";
}
else
*comm = MPI_COMM_NULL;
/* this split is effectively a dup but tests the split code paths */
merr = MPI_Comm_split(mcomm, 0, rank, comm);
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then then splitting again";
+ interCommName = "Intercomm by splitting MPI_COMM_WORLD then then splitting again";
}
else
*comm = MPI_COMM_NULL;
merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD, rleader, 12345, comm );
if (merr) MTestPrintError( merr );
}
- SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD (discarding rank 0 in the left group) then MPI_Intercomm_create'ing";
+ interCommName = "Intercomm by splitting MPI_COMM_WORLD (discarding rank 0 in the left group) then MPI_Intercomm_create'ing";
}
else {
*comm = MPI_COMM_NULL;
merr = MPI_Group_free(&newgroup);
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then discarding 0 ranks with MPI_Comm_create";
+ interCommName = "Intercomm by splitting MPI_COMM_WORLD then discarding 0 ranks with MPI_Comm_create";
}
else {
*comm = MPI_COMM_NULL;
default:
*comm = MPI_COMM_NULL;
- SMPI_VARGET_GLOBAL(interCommIdx) = -1;
+ interCommIdx = -1;
break;
}
if (size + remsize >= min_size) done = 1;
}
else {
- SMPI_VARGET_GLOBAL(interCommName) = "MPI_COMM_NULL";
+ interCommName = "MPI_COMM_NULL";
done = 1;
}
/* Advance the comm index whether we are done or not, otherwise we could
* spin forever trying to allocate a too-small communicator over and
* over again. */
- SMPI_VARGET_GLOBAL(interCommIdx)++;
+ interCommIdx++;
if (!done && *comm != MPI_COMM_NULL) {
/* avoid leaking communicators */
}
}
- return SMPI_VARGET_GLOBAL(interCommIdx);
+ return interCommIdx;
}
/* Return the name of an intercommunicator */
const char *MTestGetIntercommName( void )
{
- return SMPI_VARGET_GLOBAL(interCommName);
+ return interCommName;
}
/* Get a communicator of a given minimum size. Both intra and inter
int MTestGetComm( MPI_Comm *comm, int min_size )
{
int idx=0;
- SMPI_VARINIT_STATIC_AND_SET(getinter, int, 0);
+ static int getinter = 0;
- if (!SMPI_VARGET_STATIC(getinter)) {
+ if (!getinter) {
idx = MTestGetIntracomm( comm, min_size );
if (idx == 0) {
- SMPI_VARGET_STATIC(getinter) = 1;
+ getinter = 1;
}
}
- if (SMPI_VARGET_STATIC(getinter)) {
+ if (getinter) {
int isLeft;
idx = MTestGetIntercomm( comm, &isLeft, min_size );
if (idx == 0) {
- SMPI_VARGET_STATIC(getinter) = 0;
+ getinter = 0;
}
}
{
va_list list;
- if (SMPI_VARGET_GLOBAL(verbose) && level >= SMPI_VARGET_GLOBAL(verbose)) {
+ if (verbose && level >= verbose) {
va_start(list,format);
vprintf( format, list );
va_end(list);
{
#ifdef HAVE_GETRUSAGE
struct rusage ru;
- SMPI_VARINIT_STATIC_AND_SET(pfThreshold, int, -2);
+ static int pfThreshold = -2;
int doOutput = 1;
if (getrusage( RUSAGE_SELF, &ru ) == 0) {
/* There is an option to generate output only when a resource
exceeds a threshold. To date, only page faults supported. */
- if (SMPI_VARGET_STATIC(pfThreshold) == -2) {
+ if (pfThreshold == -2) {
char *p = getenv("MPITEST_RUSAGE_PF");
- SMPI_VARGET_STATIC(pfThreshold) = -1;
+ pfThreshold = -1;
if (p) {
- SMPI_VARGET_STATIC(pfThreshold) = strtol( p, 0, 0 );
+ pfThreshold = strtol( p, 0, 0 );
}
}
- if (SMPI_VARGET_STATIC(pfThreshold) > 0) {
- doOutput = ru.ru_minflt > SMPI_VARGET_STATIC(pfThreshold);
+ if (pfThreshold > 0) {
+ doOutput = ru.ru_minflt > pfThreshold;
}
if (doOutput) {
/* Cast values to long in case some system has defined them
/*
* Create MPI Windows
*/
-SMPI_VARINIT_GLOBAL_AND_SET(win_index, int, 0);
-SMPI_VARINIT_GLOBAL(winName, const char *);
+static int win_index = 0;
+static const char *winName;
/* Use an attribute to remember the type of memory allocation (static,
malloc, or MPI_Alloc_mem) */
-SMPI_VARINIT_GLOBAL_AND_SET(mem_keyval, int, MPI_KEYVAL_INVALID);
+static int mem_keyval = MPI_KEYVAL_INVALID;
int MTestGetWin( MPI_Win *win, int mustBePassive )
{
- typedef char actbuf_type[1024];
- SMPI_VARINIT_STATIC(actbuf, actbuf_type);
- SMPI_VARINIT_STATIC(pasbuf, char *);
+ static char actbuf[1024];
+ static char *pasbuf;
char *buf;
int n, rank, merr;
MPI_Info info;
- if (SMPI_VARGET_GLOBAL(mem_keyval) == MPI_KEYVAL_INVALID) {
+ if (mem_keyval == MPI_KEYVAL_INVALID) {
/* Create the keyval */
merr = MPI_Win_create_keyval( MPI_WIN_NULL_COPY_FN,
MPI_WIN_NULL_DELETE_FN,
- &SMPI_VARGET_GLOBAL(mem_keyval), 0 );
+ &mem_keyval, 0 );
if (merr) MTestPrintError( merr );
}
- switch (SMPI_VARGET_GLOBAL(win_index)) {
+ switch (win_index) {
case 0:
/* Active target window */
- merr = MPI_Win_create( SMPI_VARGET_STATIC(actbuf), 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
+ merr = MPI_Win_create( actbuf, 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
win );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(winName) = "active-window";
- merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)0 );
+ winName = "active-window";
+ merr = MPI_Win_set_attr( *win, mem_keyval, (void *)0 );
if (merr) MTestPrintError( merr );
break;
case 1:
/* Passive target window */
- merr = MPI_Alloc_mem( 1024, MPI_INFO_NULL, &SMPI_VARGET_STATIC(pasbuf) );
+ merr = MPI_Alloc_mem( 1024, MPI_INFO_NULL, &pasbuf );
if (merr) MTestPrintError( merr );
- merr = MPI_Win_create( SMPI_VARGET_STATIC(pasbuf), 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
+ merr = MPI_Win_create( pasbuf, 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
win );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(winName) = "passive-window";
- merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)2 );
+ winName = "passive-window";
+ merr = MPI_Win_set_attr( *win, mem_keyval, (void *)2 );
if (merr) MTestPrintError( merr );
break;
case 2:
merr = MPI_Win_create( buf, n, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
win );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(winName) = "active-all-different-win";
- merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)1 );
+ winName = "active-all-different-win";
+ merr = MPI_Win_set_attr( *win, mem_keyval, (void *)1 );
if (merr) MTestPrintError( merr );
break;
case 3:
if (merr) MTestPrintError( merr );
merr = MPI_Info_free( &info );
if (merr) MTestPrintError( merr );
- SMPI_VARGET_GLOBAL(winName) = "active-nolocks-all-different-win";
- merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)1 );
+ winName = "active-nolocks-all-different-win";
+ merr = MPI_Win_set_attr( *win, mem_keyval, (void *)1 );
if (merr) MTestPrintError( merr );
break;
default:
- SMPI_VARGET_GLOBAL(win_index) = -1;
+ win_index = -1;
}
- SMPI_VARGET_GLOBAL(win_index)++;
- return SMPI_VARGET_GLOBAL(win_index);
+ win_index++;
+ return win_index;
}
/* Return a pointer to the name associated with a window object */
const char *MTestGetWinName( void )
{
- return SMPI_VARGET_GLOBAL(winName);
+ return winName;
}
/* Free the storage associated with a window object */
void MTestFreeWin( MPI_Win *win )
}
if (addr) {
void *val;
- merr = MPI_Win_get_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), &val, &flag );
+ merr = MPI_Win_get_attr( *win, mem_keyval, &val, &flag );
if (merr) MTestPrintError( merr );
if (flag) {
if (val == (void *)1) {
}
static void MTestRMACleanup( void )
{
- if (SMPI_VARGET_GLOBAL(mem_keyval) != MPI_KEYVAL_INVALID) {
- MPI_Win_free_keyval( &SMPI_VARGET_GLOBAL(mem_keyval) );
+ if (mem_keyval != MPI_KEYVAL_INVALID) {
+ MPI_Win_free_keyval( &mem_keyval );
}
}
#else
add_executable(dwarf-expression dwarf_expression.c)
target_link_libraries(dwarf-expression simgrid)
endif()
+
+set(testsuite_src
+ ${testsuite_src}
+ ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/dwarf_expression.c
+ PARENT_SCOPE
+ )
set(bin_files
${bin_files}
${CMAKE_CURRENT_SOURCE_DIR}/fix-paje-trace.sh
+ ${CMAKE_CURRENT_SOURCE_DIR}/generate.sh
${CMAKE_CURRENT_SOURCE_DIR}/indent
+ ${CMAKE_CURRENT_SOURCE_DIR}/normalize-pointers.py
${CMAKE_CURRENT_SOURCE_DIR}/platf_route_rulebased2full.py
${CMAKE_CURRENT_SOURCE_DIR}/sg_unit_extractor.pl
${CMAKE_CURRENT_SOURCE_DIR}/sg_xml_unit_converter.py
+ src/simix/simix_network\.tla
+ src/smpi/BUGS
-+ src/smpi/colls/allreduce-rab-reduce-scatter\.c
+ src/smpi/colls/alltoall-bruck\.c
+ src/smpi/fixsrc\.pl
+ src/smpi/myprintloc\.cocci
+ tools/check_dist_archive
+ tools/check_dist_archive\.exclude
+ tools/generate-multi-jar\.py
-+ tools/normalize-pointers\.py
+ tools/update_copyright_header
+ tools/spell/.*