X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3d19322e84a968173b53302be7b8496098da783a..f15e92e5de94e0d84b2084de6e1648ce64dadbed:/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 cfb1684f1c..30da8b5dd7 100644 --- a/teshsuite/xbt/parmap_test/parmap_test.cpp +++ b/teshsuite/xbt/parmap_test/parmap_test.cpp @@ -1,18 +1,20 @@ /* parmap_test -- test parmap */ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2020. 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 -#include +#include #include #include #include #include #include // std::iota +#include +#include #include 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; } -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); } @@ -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; - simgrid::xbt::Parmap parmap(num_workers, mode); - std::vector a(len); - std::vector data(len); + simgrid::xbt::Parmap parmap(num_workers, mode); + std::vector a(len); + std::vector data(len); 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; - 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);