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)
- 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.
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,
std::vector<int> 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<void*>(obj), #obj, __FILE__, __LINE__) || true; first; \
- sthread_access_end(static_cast<void*>(obj), #obj, __FILE__, __LINE__), first = false)
+ for (bool first = sthread_access_begin(static_cast<void*>(obj), #obj, __FILE__, __LINE__, __FUNCTION__) || true; \
+ first; sthread_access_end(static_cast<void*>(obj), #obj, __FILE__, __LINE__, __FUNCTION__), first = false)
static void thread_code()
{
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<const BarrierTransition*>(o)) {
if (bar_ != other->bar_)
return false;
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;
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();
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();
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)
}
#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)
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
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})
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 /////////////////// */
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'] = ''
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'] = ''
'GlobalConcurrency':'DGlobalConcurrency',
# larger scope
'BufferingHazard':'EBufferingHazard',
+ # Input Hazard
+ 'IHCallMatching':'InputHazard',
+
'OK':'FOK'}
error_scope = {
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 /////////////////// */
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)
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)
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")
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)
# 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")
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
# 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"
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)