private:
#ifndef DOXYGEN
friend kernel::activity::ConditionVariableImpl;
- friend void kernel::activity::intrusive_ptr_release(kernel::activity::ConditionVariableImpl* cond);
+ friend XBT_PUBLIC void kernel::activity::intrusive_ptr_release(kernel::activity::ConditionVariableImpl* cond);
#endif
kernel::activity::ConditionVariableImpl* const pimpl_;
#ifndef DOXYGEN
friend ConditionVariable;
friend kernel::activity::MutexImpl;
- friend void kernel::activity::intrusive_ptr_release(kernel::activity::MutexImpl* mutex);
+ friend XBT_PUBLIC void kernel::activity::intrusive_ptr_release(kernel::activity::MutexImpl* mutex);
#endif
kernel::activity::MutexImpl* const pimpl_;
{
auto* callback = new F(std::move(f));
return xbt_automaton_propositional_symbol_new_callback(
- a, id, [](void* cb) -> int { return (*(F*)cb)(); }, callback, [](void* cb) -> void { delete (F*)cb; });
+ a, id, [](auto* cb) -> int { return (*(F*)cb)(); }, callback, [](auto* cb) -> void { delete (F*)cb; });
}
}
}
void operator()() const
{
- const int argc = args_->size();
std::vector<std::string> args = *args_;
std::vector<char*> argv(args.size() + 1); // argv[argc] is nullptr
std::transform(begin(args), end(args), begin(argv), [](std::string& s) { return &s.front(); });
- code_(argc, argv.data());
+ code_(static_cast<int>(args.size()), argv.data());
}
};
*/
template <typename T> void Parmap<T>::work()
{
- unsigned length = common_data->size();
+ unsigned length = static_cast<unsigned>(common_data->size());
unsigned index = common_index.fetch_add(1, std::memory_order_relaxed);
while (index < length) {
worker_fun((*common_data)[index]);
// Support for the boost::intrusive_ptr<ActivityImpl> datatype
friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
- int get_refcount() const { return refcount_; } // For debugging purpose
+ int get_refcount() const { return static_cast<int>(refcount_); } // For debugging purpose
static xbt::signal<void(ActivityImpl const&)> on_suspended;
static xbt::signal<void(ActivityImpl const&)> on_resumed;
ExecImpl& set_thread_count(int thread_count);
ExecImpl& set_hosts(const std::vector<s4u::Host*>& hosts);
- unsigned int get_host_number() const { return hosts_.size(); }
+ unsigned int get_host_number() const { return static_cast<unsigned>(hosts_.size()); }
double get_seq_remaining_ratio();
double get_par_remaining_ratio();
double get_remaining() const override;
std::atomic_int_fast32_t refcount_{0};
public:
- int get_refcount() const { return refcount_; }
+ int get_refcount() const { return static_cast<int>(refcount_); }
friend void intrusive_ptr_add_ref(ActorImpl* actor)
{
// This whole memory consistency semantic drives me nuts.
cb(event_list);
if(event_list.empty()) {
- event->free_me = false;
+ event->free_me = true;
+ tmgr_trace_event_unref(&event);
} else {
- //FIXME: This is a bug, but keep old behaviour for now
- //fes_->add_event(0, event);
fes_->add_event(event_list[0].date_, event);
}
return event;
}
// what do I need to read ?
MPI_Offset totreads = 0;
- for (unsigned i = 0; i < chunks.size(); i++) {
- if (chunks[i].second < my_chunk_start)
+ for (auto const& chunk : chunks) {
+ if (chunk.second < my_chunk_start)
continue;
- else if (chunks[i].first > my_chunk_end)
+ else if (chunk.first > my_chunk_end)
continue;
else
- totreads += (std::min(chunks[i].second, my_chunk_end - 1) - std::max(chunks[i].first, my_chunk_start));
+ totreads += (std::min(chunk.second, my_chunk_end - 1) - std::max(chunk.first, my_chunk_start));
}
XBT_CDEBUG(smpi_pmpi, "will have to access %lld from my chunk", totreads);
import sys
import os
-import re
from MBIutils import *
import simgrid
(name, path, binary, filename) = sys.argv
for test in parse_one_code(filename):
- execcmd = re.sub("mpirun", f"{path}/smpi_script/bin/smpirun -wrapper '{path}/bin/simgrid-mc --log=mc_safety.t:info' -platform ./cluster.xml -analyze --cfg=smpi/finalization-barrier:on --cfg=smpi/list-leaks:10 --cfg=model-check/max-depth:10000", test['cmd'])
- execcmd = re.sub('\${EXE}', binary, execcmd)
- execcmd = re.sub('\$zero_buffer', "--cfg=smpi/buffering:zero", execcmd)
- execcmd = re.sub('\$infty_buffer', "--cfg=smpi/buffering:infty", execcmd)
+ execcmd = test['cmd'].replace("mpirun", f"{path}/smpi_script/bin/smpirun -wrapper '{path}/bin/simgrid-mc --log=mc_safety.t:info' -platform ./cluster.xml -analyze --cfg=smpi/finalization-barrier:on --cfg=smpi/list-leaks:10 --cfg=model-check/max-depth:10000")
+ execcmd = execcmd.replace('${EXE}', binary)
+ execcmd = execcmd.replace('$zero_buffer', "--cfg=smpi/buffering:zero")
+ execcmd = execcmd.replace('$infty_buffer', "--cfg=smpi/buffering:infty")
if os.path.exists(f'{filename}.txt'):
os.remove(f'{filename}.txt')
if res_category != "TRUE_NEG" and res_category != "TRUE_POS":
print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n")
print(f"SimGrid gave the wrong result ({outcome} instead of {test['expect']}).")
- sys.exit(1)
\ No newline at end of file
+ sys.exit(1)
if state == 0:
state = 1
else:
- raise Exception(f"MBI_TESTS header appears a second time at line {line_num}: \n{line}")
+ raise ValueError(f"MBI_TESTS header appears a second time at line {line_num}: \n{line}")
elif re.match(".*END_MBI_TESTS.*", line):
if state == 1:
state = 2
else:
- raise Exception(f"Unexpected end of MBI_TESTS header at line {line_num}: \n{line}")
+ raise ValueError(f"Unexpected end of MBI_TESTS header at line {line_num}: \n{line}")
if state == 1 and re.match("\s+\$ ?.*", line):
m = re.match('\s+\$ ?(.*)', line)
cmd = m.group(1)
else:
m = re.match('[ |]*ERROR: *(.*)', nextline)
if not m:
- raise Exception(
+ raise ValueError(
f"\n{filename}:{line_num}: MBI parse error: Test not followed by a proper 'ERROR' line:\n{line}{nextline}")
expect = 'ERROR'
detail = m.group(1)
if detail not in possible_details:
- raise Exception(
+ raise ValueError(
f"\n{filename}:{line_num}: MBI parse error: Detailled outcome {detail} is not one of the allowed ones.")
test = {'filename': filename, 'id': test_num, 'cmd': cmd, 'expect': expect, 'detail': detail}
res.append(test.copy())
line_num += 1
if state == 0:
- raise Exception(f"MBI_TESTS header not found in file '{filename}'.")
+ raise ValueError(f"MBI_TESTS header not found in file '{filename}'.")
if state == 1:
- raise Exception(f"MBI_TESTS header not properly ended in file '{filename}'.")
+ raise ValueError(f"MBI_TESTS header not properly ended in file '{filename}'.")
if len(res) == 0:
- raise Exception(f"No test found in {filename}. Please fix it.")
+ raise ValueError(f"No test found in {filename}. Please fix it.")
return res
def categorize(tool, toolname, test_id, expected):
if outcome == 'failure':
elapsed = 0
else:
- raise Exception(f"Invalid test result: {test_id}.txt exists but not {test_id}.elapsed")
+ raise ValueError(f"Invalid test result: {test_id}.txt exists but not {test_id}.elapsed")
else:
with open(f'{test_id}.elapsed' if os.path.exists(f'{test_id}.elapsed') else f'logs/{toolname}/{test_id}.elapsed', 'r') as infile:
elapsed = infile.read()
res_category = 'TRUE_POS'
diagnostic = f'correctly detected an error'
else:
- raise Exception(f"Unexpected expectation: {expected} (must be OK or ERROR)")
+ raise ValueError(f"Unexpected expectation: {expected} (must be OK or ERROR)")
return (res_category, elapsed, diagnostic, outcome)
#print(f'Found {target} at {line}')
return res
res += 1
- raise Exception(f"Line target {target} not found in {filename}.")
+ raise ValueError(f"Line target {target} not found in {filename}.")
def make_file(template, filename, replace):
output = template
- filename = re.sub("_MPI_", "_", filename)
+ filename = filename.replace("_MPI_", "_")
replace['filename'] = filename
# Replace all variables that don't have a ':' in their name
while re.search("@\{[^@:]*\}@", output):
output = re.sub(f'@\{{{target}\}}@', replace[target], output)
#print(f"Replace {target} -> {replace[target]}")
else:
- raise Exception(f"Variable {target} used in template, but not defined.")
+ raise ValueError(f"Variable {target} used in template, but not defined.")
# Now replace all variables with a ':' in their name: line targets are like that, and we don't want to resolve them before the others change the lines
while re.search("@\{([^:@]*):([^@]*)\}@", output):
m = re.search("@\{([^:@]*):([^@]*)\}@", output)
#print(f"Replace @{{line:{target}}}@ with '{replace}'")
output = re.sub(f'@\{{line:{target}\}}@', replace, output)
else:
- raise Exception(f"Unknown variable kind: {kind}:{target}")
+ raise ValueError(f"Unknown variable kind: {kind}:{target}")
if os.path.exists(filename):
with open(filename, 'r') as file:
outfile.write(' <cluster id="acme" prefix="node-" radical="0-99" suffix="" speed="1Gf" bw="125MBps" lat="50us"/>\n')
outfile.write('</platform>\n')
- execcmd = re.sub("mpirun", "smpirun -wrapper simgrid-mc -platform ./cluster.xml -analyze --cfg=smpi/finalization-barrier:on --cfg=smpi/list-leaks:10 --cfg=model-check/max-depth:10000", execcmd)
+ execcmd = execcmd.replace("mpirun", "smpirun -wrapper simgrid-mc -platform ./cluster.xml -analyze --cfg=smpi/finalization-barrier:on --cfg=smpi/list-leaks:10 --cfg=model-check/max-depth:10000")
if re.search("Concurrency", binary): # DPOR reduction in simgrid cannot deal with RMA calls as they contain mutexes
- execcmd = re.sub("smpirun", "smpirun --cfg=model-check/reduction:none", execcmd)
- execcmd = re.sub('\${EXE}', binary, execcmd)
- execcmd = re.sub('\$zero_buffer', "--cfg=smpi/buffering:zero", execcmd)
- execcmd = re.sub('\$infty_buffer', "--cfg=smpi/buffering:infty", execcmd)
+ execcmd = execcmd.replace("smpirun", "smpirun --cfg=model-check/reduction:none")
+ execcmd = execcmd.replace('${EXE}', binary)
+ execcmd = execcmd.replace('$zero_buffer', "--cfg=smpi/buffering:zero")
+ execcmd = execcmd.replace('$infty_buffer', "--cfg=smpi/buffering:infty")
run_cmd(
buildcmd=f"smpicc {filename} -trace-call-location -g -Wl,-znorelro -Wl,-znoseparate-code -o {binary}",