Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
SimpleCSRtoSYCLVectorConverter.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/data/SYCLVector.h>
15
16#include <alien/kernels/sycl/SYCLBackEnd.h>
17#include <alien/kernels/simple_csr/SimpleCSRVector.h>
18#include <alien/kernels/simple_csr/SimpleCSRBackEnd.h>
19using namespace Alien;
20
21/*---------------------------------------------------------------------------*/
22
23class SimpleCSRtoSYCLVectorConverter : public IVectorConverter
24{
25 public:
26 SimpleCSRtoSYCLVectorConverter();
27 virtual ~SimpleCSRtoSYCLVectorConverter() {}
28
29 public:
30 Alien::BackEndId sourceBackend() const
31 {
33 }
34 Alien::BackEndId targetBackend() const
35 {
37 }
38 void convert(const IVectorImpl* sourceImpl, IVectorImpl* targetImpl) const;
39};
40
41/*---------------------------------------------------------------------------*/
42
43SimpleCSRtoSYCLVectorConverter::SimpleCSRtoSYCLVectorConverter()
44{
45 ;
46}
47
48/*---------------------------------------------------------------------------*/
49
51const IVectorImpl* sourceImpl, IVectorImpl* targetImpl) const
52{
57
58 alien_debug(
59 [&] { cout() << "Converting SimpleCSRVector: " << &v << " to SYCLVector " << &v2; });
60
61 ConstArrayView<Real> values = v.values();
62 v2.setValues(values.size(), values.data());
63}
64
65/*---------------------------------------------------------------------------*/
66
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
Alien::BackEndId sourceBackend() const
Get the source backend id.
Alien::BackEndId targetBackend() const
Get the target backend id.
void convert(const IVectorImpl *sourceImpl, IVectorImpl *targetImpl) const
Convert a vector from one format to another.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17