Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
HCSRtoSYCLVectorConverter.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7
8#include <iostream>
9#include <vector>
10
11#include <alien/core/backend/IVectorConverter.h>
13
14#include <alien/kernels/sycl/SYCLBackEnd.h>
15
16#include <alien/kernels/sycl/data/SYCLVector.h>
17#include <alien/kernels/sycl/data/HCSRVector.h>
18
19#include "alien/kernels/sycl/data/SYCLVectorInternal.h"
20#include "alien/kernels/sycl/data/HCSRVectorInternal.h"
21
22using namespace Alien;
23
24/*---------------------------------------------------------------------------*/
25
26class HCSRtoSYCLVectorConverter : public IVectorConverter
27{
28 public:
29 HCSRtoSYCLVectorConverter();
30 virtual ~HCSRtoSYCLVectorConverter() {}
31
32 public:
33 Alien::BackEndId sourceBackend() const
34 {
36 }
37 Alien::BackEndId targetBackend() const
38 {
40 }
41 void convert(const IVectorImpl* sourceImpl, IVectorImpl* targetImpl) const;
42};
43
44/*---------------------------------------------------------------------------*/
45
46HCSRtoSYCLVectorConverter::HCSRtoSYCLVectorConverter()
47{
48 ;
49}
50
51/*---------------------------------------------------------------------------*/
52
54const IVectorImpl* sourceImpl, IVectorImpl* targetImpl) const
55{
56 const HCSRVector<double>& v =
60
61 alien_debug(
62 [&] { cout() << "Converting HCSRVector: " << &v << " to SYCLVector " << &v2; });
63
64 v2.internal()->copy(v.internal()->values());
65}
66
67/*---------------------------------------------------------------------------*/
68
VectorConverterRegisterer.h.
#define REGISTER_VECTOR_CONVERTER(converter)
Macro to register a vector converter.
static T & cast(IVectorImpl *impl, BackEndId backend)
Cast a vector implementation in its actual type.
Interface to handle abstract vectors implementation.
Definition IVectorImpl.h:47
void convert(const IVectorImpl *sourceImpl, IVectorImpl *targetImpl) const
Convert a vector from one format to another.
Alien::BackEndId sourceBackend() const
Get the source backend id.
Alien::BackEndId targetBackend() const
Get the target backend id.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17