From: Fred Suter Date: Tue, 24 Oct 2023 22:00:52 +0000 (-0400) Subject: Merge branch 'master' into mq X-Git-Tag: v3.35~89^2~28^2~11 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/89d7a404bbe64b7f19e6743d2979468f1cac42a2?hp=6e0d0f6c1580aceb13c060bbf95cbe9000cf6bbd Merge branch 'master' into mq --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a4a2459c5..03b4b09a68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,21 +217,25 @@ if(enable_ns3) endif() ### Check for Eigen library -set(SIMGRID_HAVE_EIGEN3 OFF) -find_package (Eigen3 3.3 CONFIG - HINTS ${EIGEN3_HINT}) -if (Eigen3_FOUND) - set(SIMGRID_HAVE_EIGEN3 ON) - message(STATUS "Found Eigen3: ${EIGEN3_INCLUDE_DIR}") - include_directories(${EIGEN3_INCLUDE_DIR}) - if ("3.3.4" VERSION_EQUAL EIGEN3_VERSION_STRING AND CMAKE_COMPILER_IS_GNUCC) - message(STATUS "Avoid build error of Eigen3 v3.3.4 using -Wno-error=int-in-bool-context") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=int-in-bool-context") +if ((NOT DEFINED EIGEN3_HINT) OR (NOT EIGEN3_HINT STRLESS_EQUAL "OFF")) + set(SIMGRID_HAVE_EIGEN3 OFF) + find_package (Eigen3 3.3 CONFIG + HINTS ${EIGEN3_HINT}) + if (Eigen3_FOUND) + set(SIMGRID_HAVE_EIGEN3 ON) + message(STATUS "Found Eigen3: ${EIGEN3_INCLUDE_DIR}") + include_directories(${EIGEN3_INCLUDE_DIR}) + if ("3.3.4" VERSION_EQUAL EIGEN3_VERSION_STRING AND CMAKE_COMPILER_IS_GNUCC) + message(STATUS "Avoid build error of Eigen3 v3.3.4 using -Wno-error=int-in-bool-context") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=int-in-bool-context") + endif() + else() + message(STATUS "Disabling model BMF because Eigen3 was not found. If it's installed, use EIGEN3_HINT to hint cmake about the location of Eigen3Config.cmake") endif() + mark_as_advanced(Eigen3_DIR) else() - message(STATUS "Disabling model BMF because Eigen3 was not found. If it's installed, use EIGEN3_HINT to hint cmake about the location of Eigen3Config.cmake") + message(STATUS "Disabling Eigen3 as requested by the user (EIGEN3_HINT is set to 'OFF')") endif() -mark_as_advanced(Eigen3_DIR) # Check for our JSON dependency set(SIMGRID_HAVE_JSON 0) diff --git a/docs/source/Installing_SimGrid.rst b/docs/source/Installing_SimGrid.rst index 477b53ed9a..7d268678ef 100644 --- a/docs/source/Installing_SimGrid.rst +++ b/docs/source/Installing_SimGrid.rst @@ -108,7 +108,7 @@ Eigen3 (optional) - On Debian / Ubuntu: ``apt install libeigen3-dev`` - On CentOS / Fedora: ``dnf install eigen3-devel`` - On macOS with homebrew: ``brew install eigen`` - - Use EIGEN3_HINT to specify where it's installed if cmake doesn't find it automatically. + - Use EIGEN3_HINT to specify where it's installed if cmake doesn't find it automatically. Set EIGEN3_HINT=OFF to disable detection even if it could be found. JSON (optional, for the DAG wfcommons loader) - On Debian / Ubuntu: ``apt install nlohmann-json3-dev`` - Use nlohmann_json_HINT to specify where it's installed if cmake doesn't find it automatically. @@ -269,6 +269,7 @@ NS3_HINT (empty by default) EIGEN3_HINT (empty by default) Alternative path into which Eigen3 should be searched for. + Providing the value OFF as an hint will disable the detection alltogether. SIMGRID_PYTHON_LIBDIR (auto-detected) Where to install the Python module library. By default, it is set to the cmake Python3_SITEARCH variable if installing to /usr, diff --git a/examples/sthread/stdobject/stdobject.cpp b/examples/sthread/stdobject/stdobject.cpp index 06e49c86a5..246095eaef 100644 --- a/examples/sthread/stdobject/stdobject.cpp +++ b/examples/sthread/stdobject/stdobject.cpp @@ -6,13 +6,15 @@ std::vector v = {1, 2, 3, 5, 8, 13}; extern "C" { -extern int sthread_access_begin(void* addr, const char* objname, const char* file, int line) __attribute__((weak)); -extern void sthread_access_end(void* addr, const char* objname, const char* file, int line) __attribute__((weak)); +extern int sthread_access_begin(void* addr, const char* objname, const char* file, int line, const char* func) + __attribute__((weak)); +extern void sthread_access_end(void* addr, const char* objname, const char* file, int line, const char* func) + __attribute__((weak)); } #define STHREAD_ACCESS(obj) \ - for (bool first = sthread_access_begin(static_cast(obj), #obj, __FILE__, __LINE__) || true; first; \ - sthread_access_end(static_cast(obj), #obj, __FILE__, __LINE__), first = false) + for (bool first = sthread_access_begin(static_cast(obj), #obj, __FILE__, __LINE__, __FUNCTION__) || true; \ + first; sthread_access_end(static_cast(obj), #obj, __FILE__, __LINE__, __FUNCTION__), first = false) static void thread_code() { diff --git a/src/mc/transition/TransitionSynchro.cpp b/src/mc/transition/TransitionSynchro.cpp index a0c16de759..df630eec34 100644 --- a/src/mc/transition/TransitionSynchro.cpp +++ b/src/mc/transition/TransitionSynchro.cpp @@ -29,6 +29,10 @@ bool BarrierTransition::depends(const Transition* o) const if (o->type_ < type_) return o->depends(this); + // Actions executed by the same actor are always dependent + if (o->aid_ == aid_) + return true; + if (const auto* other = dynamic_cast(o)) { if (bar_ != other->bar_) return false; diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index 94bb62be2a..8cf9b41312 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -381,6 +381,8 @@ int PMPI_Sendrecv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, int CHECK_TYPE(8, recvtype) CHECK_BUFFER(1, sendbuf, sendcount, sendtype) CHECK_BUFFER(6, recvbuf, recvcount, recvtype) + CHECK_ARGS(sendbuf == recvbuf && sendcount > 0 && recvcount > 0, MPI_ERR_BUFFER, + "%s: Invalid parameters 1 and 6: sendbuf and recvbuf must be disjoint", __func__); CHECK_TAG(10, recvtag) CHECK_COMM(11) const SmpiBenchGuard suspend_bench; diff --git a/src/sthread/ObjectAccess.cpp b/src/sthread/ObjectAccess.cpp index 6e38668af8..ea12a53ab3 100644 --- a/src/sthread/ObjectAccess.cpp +++ b/src/sthread/ObjectAccess.cpp @@ -73,7 +73,7 @@ static ObjectOwner* get_owner(void* object) return o; } -int sthread_access_begin(void* objaddr, const char* objname, const char* file, int line) +int sthread_access_begin(void* objaddr, const char* objname, const char* file, int line, const char* func) { sthread_disable(); auto* self = simgrid::kernel::actor::ActorImpl::self(); @@ -106,7 +106,7 @@ int sthread_access_begin(void* objaddr, const char* objname, const char* file, i sthread_enable(); return true; } -void sthread_access_end(void* objaddr, const char* objname, const char* file, int line) +void sthread_access_end(void* objaddr, const char* objname, const char* file, int line, const char* func) { sthread_disable(); auto* self = simgrid::kernel::actor::ActorImpl::self(); diff --git a/src/sthread/sthread.h b/src/sthread/sthread.h index 65279685e6..ba4252e2d0 100644 --- a/src/sthread/sthread.h +++ b/src/sthread/sthread.h @@ -53,8 +53,8 @@ int sthread_sem_timedwait(sthread_sem_t* sem, const struct timespec* abs_timeout int sthread_gettimeofday(struct timeval* tv); void sthread_sleep(double seconds); -int sthread_access_begin(void* objaddr, const char* objname, const char* file, int line); -void sthread_access_end(void* objaddr, const char* objname, const char* file, int line); +int sthread_access_begin(void* objaddr, const char* objname, const char* file, int line, const char* function); +void sthread_access_end(void* objaddr, const char* objname, const char* file, int line, const char* function); #if defined(__cplusplus) } diff --git a/src/xbt/xbt_os_time.c b/src/xbt/xbt_os_time.c index b6a16ad27f..f0d5401389 100644 --- a/src/xbt/xbt_os_time.c +++ b/src/xbt/xbt_os_time.c @@ -40,11 +40,11 @@ double xbt_os_time(void) #if HAVE_GETTIMEOFDAY struct timeval tv; gettimeofday(&tv, NULL); + + return (double)tv.tv_sec + (double)tv.tv_usec / 1e6; #else /* no gettimeofday => poor resolution */ return (double) (time(NULL)); #endif /* HAVE_GETTIMEOFDAY? */ - - return (double)tv.tv_sec + (double)tv.tv_usec / 1e6; } void xbt_os_sleep(double sec) @@ -59,7 +59,7 @@ void xbt_os_sleep(double sec) struct timeval timeout; timeout.tv_sec = (long)sec; - timeout.tv_usec = (long)(sec - floor(sec)) * 1e6); + timeout.tv_usec = (long)(sec - floor(sec)) * 1e6; select(0, NULL, NULL, NULL, &timeout); #endif diff --git a/teshsuite/smpi/MBI/CMakeLists.txt b/teshsuite/smpi/MBI/CMakeLists.txt index d4f9eb8c92..d0c587e9cc 100644 --- a/teshsuite/smpi/MBI/CMakeLists.txt +++ b/teshsuite/smpi/MBI/CMakeLists.txt @@ -64,6 +64,7 @@ if (enable_smpi_MBI_testsuite) add_executable(mbi_${basefile} EXCLUDE_FROM_ALL ${CMAKE_BINARY_DIR}/MBI/${cfile}) target_link_libraries(mbi_${basefile} simgrid) target_compile_options(mbi_${basefile} PRIVATE "-Wno-unused-variable") + target_compile_options(mbi_${basefile} PRIVATE "-Wno-unused-but-set-variable") set_target_properties(mbi_${basefile} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/MBI) add_dependencies(tests-mbi mbi_${basefile}) diff --git a/teshsuite/smpi/MBI/InputHazardGenerator.py b/teshsuite/smpi/MBI/InputHazardGenerator.py index 899e810f96..d9f8a5141c 100755 --- a/teshsuite/smpi/MBI/InputHazardGenerator.py +++ b/teshsuite/smpi/MBI/InputHazardGenerator.py @@ -26,11 +26,11 @@ END_MPI_FEATURES BEGIN_MBI_TESTS $ mpirun -np 2 ${EXE} 1 - | @{outcome}@ - | @{errormsg}@ + | @{outcome1}@ + | @{errormsg1}@ $ mpirun -np 2 ${EXE} 2 - | @{outcome}@ - | @{errormsg}@ + | @{outcome2}@ + | @{errormsg2}@ END_MBI_TESTS ////////////////////// End of MBI headers /////////////////// */ @@ -127,16 +127,20 @@ for s in gen.send + gen.isend: replace = patterns.copy() replace['shortdesc'] = 'Correct call ordering.' replace['longdesc'] = 'Correct call ordering.' - replace['outcome'] = 'OK' - replace['errormsg'] = 'OK' + replace['outcome1'] = 'OK' + replace['errormsg1'] = 'OK' + replace['outcome2'] = 'OK' + replace['errormsg2'] = 'OK' gen.make_file(template, f'InputHazardCallOrdering_{r}_{s}_ok.c', replace) # Generate the incorrect matching replace = patterns.copy() replace['shortdesc'] = 'Missing Send function.' replace['longdesc'] = 'Missing Send function call for a path depending to input, a deadlock is created.' - replace['outcome'] = 'ERROR: IHCallMatching' - replace['errormsg'] = 'P2P mistmatch. Missing @{r}@ at @{filename}@:@{line:MBIERROR}@.' + replace['outcome1'] = 'OK' + replace['errormsg1'] = 'OK' + replace['outcome2'] = 'ERROR: IHCallMatching' + replace['errormsg2'] = 'P2P mistmatch. Missing @{r}@ at @{filename}@:@{line:MBIERROR}@.' replace['errorcond'] = '/* MBIERROR */' replace['operation1b'] = '' replace['fini1b'] = '' @@ -172,16 +176,20 @@ for c in gen.coll: replace = patterns.copy() replace['shortdesc'] = 'Correct call ordering.' replace['longdesc'] = 'Correct call ordering.' - replace['outcome'] = 'OK' - replace['errormsg'] = 'OK' + replace['outcome1'] = 'OK' + replace['errormsg1'] = 'OK' + replace['outcome2'] = 'OK' + replace['errormsg2'] = 'OK' gen.make_file(template, f'InputHazardCallOrdering_{c}_ok.c', replace) # Generate the incorrect matching replace = patterns.copy() replace['shortdesc'] = 'Missing collective function call.' replace['longdesc'] = 'Missing collective function call for a path depending to input, a deadlock is created.' - replace['outcome'] = 'ERROR: IHCallMatching' - replace['errormsg'] = 'P2P mistmatch. Missing @{c}@ at @{filename}@:@{line:MBIERROR}@.' + replace['outcome1'] = 'OK' + replace['errormsg1'] = 'OK' + replace['outcome2'] = 'ERROR: IHCallMatching' + replace['errormsg2'] = 'P2P mistmatch. Missing @{c}@ at @{filename}@:@{line:MBIERROR}@.' replace['errorcond'] = '/* MBIERROR */' replace['operation1b'] = '' replace['fini1b'] = '' diff --git a/teshsuite/smpi/MBI/MBIutils.py b/teshsuite/smpi/MBI/MBIutils.py index c422cca055..9a7d837293 100644 --- a/teshsuite/smpi/MBI/MBIutils.py +++ b/teshsuite/smpi/MBI/MBIutils.py @@ -67,6 +67,9 @@ possible_details = { 'GlobalConcurrency':'DGlobalConcurrency', # larger scope 'BufferingHazard':'EBufferingHazard', + # Input Hazard + 'IHCallMatching':'InputHazard', + 'OK':'FOK'} error_scope = { diff --git a/teshsuite/smpi/MBI/P2PBufferingGenerator.py b/teshsuite/smpi/MBI/P2PBufferingGenerator.py index 05253b8738..663a548a32 100755 --- a/teshsuite/smpi/MBI/P2PBufferingGenerator.py +++ b/teshsuite/smpi/MBI/P2PBufferingGenerator.py @@ -25,11 +25,11 @@ END_MPI_FEATURES BEGIN_MBI_TESTS $ mpirun -np 4 $zero_buffer ${EXE} - | @{outcome1}@ - | @{errormsg1}@ + | @{outcome_zerob}@ + | @{errormsg_zerob}@ $ mpirun -np 4 $infty_buffer ${EXE} - | @{outcome1}@ - | @{errormsg1}@ + | @{outcome_infty}@ + | @{errormsg_infty}@ END_MBI_TESTS ////////////////////// End of MBI headers /////////////////// */ @@ -123,8 +123,10 @@ for s in gen.send + gen.isend: replace = patterns.copy() replace['shortdesc'] = 'Point to point @{s}@ and @{r}@ may not be matched' replace['longdesc'] = 'Processes 0 and 1 both call @{s}@ and @{r}@. This results in a deadlock depending on the buffering mode' - replace['outcome1'] = 'ERROR: BufferingHazard' - replace['errormsg1'] = f'Buffering Hazard. Possible deadlock depending the buffer size of MPI implementation and system environment cause by two processes call {s} before {r}.' + replace['outcome_zerob'] = 'ERROR: BufferingHazard' + replace['errormsg_zerob'] = f'Buffering Hazard. Possible deadlock depending the buffer size of MPI implementation and system environment cause by two processes call {s} before {r}.' + replace['outcome_infty'] = 'OK' + replace['errormsg_infty'] = 'OK' gen.make_file(template, f'P2PBuffering_{s}_{r}_{s}_{r}_nok.c', replace) # Generate the incorrect matching with send message to the same process depending on the buffering mode (send + recv) @@ -136,8 +138,10 @@ for s in gen.send + gen.isend: replace['dest2'] = '1' replace['shortdesc'] = 'Point to point @{s}@ and @{r}@ may not be matched' replace['longdesc'] = 'Processes 0 and 1 both call @{s}@ and @{r}@. This results in a deadlock depending on the buffering mode' - replace['outcome1'] = 'ERROR: BufferingHazard' - replace['errormsg1'] = f'Buffering Hazard. Possible deadlock depending the buffer size of MPI implementation and system environment cause Send message to the same process.' + replace['outcome_zerob'] = 'ERROR: BufferingHazard' + replace['errormsg_zerob'] = f'Buffering Hazard. Possible deadlock depending the buffer size of MPI implementation and system environment cause Send message to the same process.' + replace['outcome_infty'] = 'OK' + replace['errormsg_infty'] = 'OK' gen.make_file(template, f'P2PBuffering_SameProcess_{s}_{r}_nok.c', replace) # Generate the incorrect matching with circular send message depending on the buffering mode (send + recv) @@ -155,16 +159,20 @@ for s in gen.send + gen.isend: replace['operation2c'] = gen.operation[r]("2") replace['shortdesc'] = 'Point to point @{s}@ and @{r}@ may not be matched' replace['longdesc'] = 'Processes 0 and 1 both call @{s}@ and @{r}@. This results in a deadlock depending on the buffering mode' - replace['outcome1'] = 'ERROR: BufferingHazard' - replace['errormsg1'] = f'Buffering Hazard. Possible deadlock depending the buffer size of MPI implementation and system environment cause circular send message.' + replace['outcome_zerob'] = 'ERROR: BufferingHazard' + replace['errormsg_zerob'] = f'Buffering Hazard. Possible deadlock depending the buffer size of MPI implementation and system environment cause circular send message.' + replace['outcome_infty'] = 'OK' + replace['errormsg_infty'] = 'OK' gen.make_file(template, f'P2PBuffering_Circular_{s}_{r}_nok.c', replace) # Generate the incorrect matching depending on the buffering mode (recv + send) replace = patterns.copy() replace['shortdesc'] = 'Point to point @{s}@ and @{r}@ are not matched' replace['longdesc'] = 'Processes 0 and 1 both call @{r}@ and @{s}@. This results in a deadlock' - replace['outcome1'] = 'ERROR: CallMatching' - replace['errormsg1'] = 'ERROR: CallMatching' + replace['outcome_zerob'] = 'ERROR: CallMatching' + replace['errormsg_zerob'] = 'ERROR: CallMatching' + replace['outcome_infty'] = 'ERROR: CallMatching' + replace['errormsg_infty'] = 'ERROR: CallMatching' replace['operation1a'] = gen.operation[r]("2") replace['fini1a'] = gen.fini[r]("2") replace['operation2a'] = gen.operation[s]("1") @@ -179,10 +187,19 @@ for s in gen.send + gen.isend: replace = patterns.copy() replace['shortdesc'] = 'Point to point @{s}@ and @{r}@ are correctly matched' replace['longdesc'] = 'Process 0 calls @{s}@ and process 1 calls @{r}@.' - replace['outcome1'] = 'OK' - replace['errormsg1'] = 'OK' - replace['fini1a'] = gen.fini[s]("1") - replace['fini2a'] = gen.fini[r]("2") + replace['outcome_zerob'] = 'OK' + replace['errormsg_zerob'] = 'OK' + replace['outcome_infty'] = 'OK' + replace['errormsg_infty'] = 'OK' + patterns['init1'] = gen.init[s]("1") replace['operation1a'] = gen.operation[s]("1") - replace['operation2a'] = gen.operation[r]("2") + replace['fini1a'] = gen.fini[s]("1") + replace['operation2a'] = '' + replace['fini2a'] = '' + + patterns['init2'] = gen.init[r]("2") + replace['operation1b'] = gen.operation[r]("2") + replace['fini1b'] = gen.fini[r]("2") + replace['operation2b'] = '' + replace['fini2b'] = '' gen.make_file(template, f'P2PCallMatching_{s}_{r}_{r}_{s}_ok.c', replace) diff --git a/teshsuite/smpi/MBI/P2PSendrecvArgGenerator.py b/teshsuite/smpi/MBI/P2PSendrecvArgGenerator.py index 8ed991fed7..ef6fb16e42 100644 --- a/teshsuite/smpi/MBI/P2PSendrecvArgGenerator.py +++ b/teshsuite/smpi/MBI/P2PSendrecvArgGenerator.py @@ -126,7 +126,7 @@ for s in gen.send: # Generate a code with non distinct buffer replace = patterns.copy() replace['shortdesc'] = 'Invalid buffer on Sendrecv function.' - replace['longdesc'] = 'Invalid buffer on Sendrecv, the tow buffers must be distinct.' + replace['longdesc'] = 'Invalid buffer on Sendrecv, the two buffers must be distinct.' replace['outcome'] = 'ERROR: InvalidBuffer' replace['errormsg'] = '@{sr}@ at @{filename}@:@{line:MBIERROR}@ send buffer and recv buffer must be distinct.' replace['change_arg'] = gen.write[sr]("2") diff --git a/teshsuite/smpi/MBI/generator_utils.py b/teshsuite/smpi/MBI/generator_utils.py index 3801ae271b..af5750bbd5 100644 --- a/teshsuite/smpi/MBI/generator_utils.py +++ b/teshsuite/smpi/MBI/generator_utils.py @@ -358,7 +358,7 @@ start['MPI_Sendrecv'] = lambda n: "" operation['MPI_Sendrecv'] = lambda n: f'MPI_Sendrecv(psbuf{n}, buff_size, type, dest, stag, prbuf{n}, buff_size, type, src, rtag, newcom, &sta{n});' fini['MPI_Sendrecv'] = lambda n: "" free['MPI_Sendrecv'] = lambda n: "" -write['MPI_Sendrecv'] = lambda n: f"prbuf{n} = &sbuf{n}[2];" +write['MPI_Sendrecv'] = lambda n: f"prbuf{n} = &sbuf{n}[0];" ### P2P:nonblocking diff --git a/tools/cmake/Distrib.cmake b/tools/cmake/Distrib.cmake index 4f0c8c7d7e..6a144b1ddf 100644 --- a/tools/cmake/Distrib.cmake +++ b/tools/cmake/Distrib.cmake @@ -43,6 +43,7 @@ add_custom_target(simgrid_convert_TI_traces ALL # libraries install(TARGETS simgrid DESTINATION ${CMAKE_INSTALL_LIBDIR}/) +install(TARGETS sthread DESTINATION ${CMAKE_INSTALL_LIBDIR}/) # pkg-config files configure_file("${CMAKE_HOME_DIRECTORY}/tools/pkg-config/simgrid.pc.in" diff --git a/tools/cmake/MakeLib.cmake b/tools/cmake/MakeLib.cmake index f41f3b70af..e0357bf6e4 100644 --- a/tools/cmake/MakeLib.cmake +++ b/tools/cmake/MakeLib.cmake @@ -29,6 +29,7 @@ add_dependencies(simgrid maintainer_files) if("${CMAKE_SYSTEM}" MATCHES "Linux") add_library(sthread SHARED ${STHREAD_SRC}) + set_target_properties(sthread PROPERTIES VERSION ${libsimgrid_version}) set_property(TARGET sthread APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}") target_link_libraries(sthread simgrid)