8#include <gtest/gtest.h>
10#include "arccore/base/PlatformUtils.h"
12#include "arccore/common/accelerator/Runner.h"
13#include "arccore/common/accelerator/RunQueue.h"
14#include "arccore/common/NumArray.h"
19#include "arccore/accelerator/internal/Initializer.h"
21#include "./TestCommon.h"
35 Int32 nb_value, Int32 nb_part, Int32 nb_loop);
37void _doTestLoop(
bool use_accelerator, Int32 max_allowed_thread)
40 Runner runner(x.executionPolicy());
42 if (queue.isAcceleratorPolicy())
45 Int32 nb_value = 5000000;
47 Int32 nb_thread = 256;
49 if (!queue.isAcceleratorPolicy()) {
61 std::cout <<
"Using accelerator policy name=" << queue.executionPolicy() <<
"\n";
62 std::cout <<
" nb_loop=" << nb_loop <<
" nb_value=" << nb_value <<
"\n";
68 host_a.resize(nb_value);
69 host_b.resize(nb_value);
70 host_c.resize(nb_value);
72 for (Int32 i = 0; i < nb_value; ++i) {
84 for (Int32 k = 1; k < 5; ++k) {
87 _testLoopDirect(queue, a, b, c, nb_thread, nb_value, nb_part, nb_loop);
90 for (Int32 i = 0; i < nb_value; ++i) {
91 Int64 expected_value = host_a(i) + host_b(i);
92 Int64 value = host_c(i);
93 ASSERT_EQ(value, expected_value);
100ARCCORE_TEST_DO_TEST_ACCELERATOR(ArccoreAccelerator, TestLoop1, _doTestLoop);
Types and functions for managing synchronizations on accelerators.
Types and macros for managing loops on accelerators.
Internal class to initialize the accelerator runtime.
Execution queue for an accelerator.
Execution manager for accelerator.
Multi-dimensional arrays for numerical types accessible on accelerators.
View of an array of elements of type T.
Namespace for accelerator usage.
RunQueue makeQueue(const Runner &runner)
Creates a queue associated with runner.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
bool arccoreIsDebug()
True if the ARCCORE_DEBUG macro is defined.
eMemoryResource
List of available memory resources.
@ Host
Allocates on the host.
@ Device
Allocates on the device.