Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
SYCLtoSimpleCSRVectorConverter.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
9#include <iostream>
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 SYCLtoSimpleCSRVectorConverter : public IVectorConverter
24{
25 public:
26 SYCLtoSimpleCSRVectorConverter();
27 virtual ~SYCLtoSimpleCSRVectorConverter() {}
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
43SYCLtoSimpleCSRVectorConverter::SYCLtoSimpleCSRVectorConverter()
44{
45 ;
46}
47
48/*---------------------------------------------------------------------------*/
49
51const IVectorImpl* sourceImpl, IVectorImpl* targetImpl) const
52{
53 const SYCLVector<double>& sycl_v =
57
58 alien_debug([&] { cout() << "Converting SYCLVector: " << &sycl_v << " to SimpleCSRVector " << &csr_v; });
59 sycl_v.copyValuesTo(csr_v.values().size(), csr_v.getDataPtr());
60}
61
62/*---------------------------------------------------------------------------*/
63
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 targetBackend() const
Get the target backend id.
Alien::BackEndId sourceBackend() const
Get the source backend id.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17