A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a cmake flag to not compile MSG at all
[simgrid.git]
/
teshsuite
/
xbt
/
parmap_test
/
parmap_test.cpp
diff --git
a/teshsuite/xbt/parmap_test/parmap_test.cpp
b/teshsuite/xbt/parmap_test/parmap_test.cpp
index
cfb1684
..
30da8b5
100644
(file)
--- a/
teshsuite/xbt/parmap_test/parmap_test.cpp
+++ b/
teshsuite/xbt/parmap_test/parmap_test.cpp
@@
-1,18
+1,20
@@
/* parmap_test -- test parmap */
/* parmap_test -- test parmap */
-/* Copyright (c) 2007-20
17
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-20
20
. The SimGrid Team. All rights reserved. */
/* 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 "src/internal_config.h" // HAVE_FUTEX_H
/* 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 "src/internal_config.h" // HAVE_FUTEX_H
-#include <simgrid/
msg.h
>
+#include <simgrid/
s4u/Engine.hpp
>
#include <xbt.h>
#include <xbt/parmap.hpp>
#include <algorithm>
#include <cstdlib>
#include <numeric> // std::iota
#include <xbt.h>
#include <xbt/parmap.hpp>
#include <algorithm>
#include <cstdlib>
#include <numeric> // std::iota
+#include <sstream>
+#include <thread>
#include <vector>
XBT_LOG_NEW_DEFAULT_CATEGORY(parmap_test, "Test for parmap");
#include <vector>
XBT_LOG_NEW_DEFAULT_CATEGORY(parmap_test, "Test for parmap");
@@
-50,9
+52,11
@@
static int test_parmap_basic(e_xbt_parmap_mode_t mode)
return ret;
}
return ret;
}
-static void fun_get_id(
uintptr_t
* arg)
+static void fun_get_id(
std::string
* arg)
{
{
- *arg = (uintptr_t)xbt_os_thread_self();
+ std::stringstream ss;
+ ss << std::this_thread::get_id();
+ *arg = ss.str();
xbt_os_sleep(0.05);
}
xbt_os_sleep(0.05);
}
@@
-63,9
+67,9
@@
static int test_parmap_extended(e_xbt_parmap_mode_t mode)
for (unsigned num_workers = 1; num_workers <= 16; num_workers *= 2) {
const unsigned len = 2 * num_workers;
for (unsigned num_workers = 1; num_workers <= 16; num_workers *= 2) {
const unsigned len = 2 * num_workers;
- simgrid::xbt::Parmap<
uintptr_t
*> parmap(num_workers, mode);
- std::vector<
uintptr_t
> a(len);
- std::vector<
uintptr_t
*> data(len);
+ simgrid::xbt::Parmap<
std::string
*> parmap(num_workers, mode);
+ std::vector<
std::string
> a(len);
+ std::vector<
std::string
*> data(len);
std::iota(begin(data), end(data), &a[0]);
parmap.apply(fun_get_id, data);
std::iota(begin(data), end(data), &a[0]);
parmap.apply(fun_get_id, data);
@@
-83,7
+87,9
@@
static int test_parmap_extended(e_xbt_parmap_mode_t mode)
int main(int argc, char** argv)
{
int status = 0;
int main(int argc, char** argv)
{
int status = 0;
- MSG_init(&argc, argv);
+ xbt_log_control_set("parmap_test.fmt:[%c/%p]%e%m%n");
+ simgrid::s4u::Engine e(&argc, argv);
+ SIMIX_context_set_nthreads(16); // dummy value > 1
XBT_INFO("Basic testing posix");
status += test_parmap_basic(XBT_PARMAP_POSIX);
XBT_INFO("Basic testing posix");
status += test_parmap_basic(XBT_PARMAP_POSIX);