Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
[sycl]]: simplify factories
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricchevalier19 committed Apr 13, 2023
1 parent 9150481 commit aa2b050
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/core/alien/kernels/sycl/SYCLBackEnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ struct SYCLBEllPackTraits
// clang-format on
};

extern SYCLBEllPackTraits<Real>::AlgebraType* SYCLInternalLinearAlgebraFactory();
extern SYCLBEllPackTraits<Real>::AlgebraExprType*
extern std::unique_ptr<SYCLBEllPackTraits<Real>::AlgebraType> SYCLInternalLinearAlgebraFactory();
extern std::unique_ptr<SYCLBEllPackTraits<Real>::AlgebraExprType>
SYCLInternalLinearAlgebraExprFactory();

/*---------------------------------------------------------------------------*/
Expand All @@ -82,12 +82,12 @@ struct AlgebraTraits<BackEnd::tag::sycl>
typedef SYCLBEllPackTraits<Real>::AlgebraExprType algebra_expr_type;
// clang-format on

static algebra_type* algebra_factory(
static std::unique_ptr<algebra_type> algebra_factory(
IMessagePassingMng* p_mng ALIEN_UNUSED_PARAM = nullptr)
{
return SYCLInternalLinearAlgebraFactory();
}
static algebra_expr_type* algebra_expr_factory(
static std::unique_ptr<algebra_expr_type> algebra_expr_factory(
IMessagePassingMng* p_mng ALIEN_UNUSED_PARAM = nullptr)
{
return SYCLInternalLinearAlgebraExprFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ using namespace Arccore;
template class ALIEN_EXPORT LinearAlgebra<BackEnd::tag::sycl>;
template class ALIEN_EXPORT LinearAlgebraExpr<BackEnd::tag::sycl>;

ALIEN_EXPORT IInternalLinearAlgebra<SYCLBEllPackMatrix<Real>, SYCLVector<Real>>*
ALIEN_EXPORT std::unique_ptr<IInternalLinearAlgebra<SYCLBEllPackMatrix<Real>, SYCLVector<Real>>>
SYCLInternalLinearAlgebraFactory()
{
return new SYCLInternalLinearAlgebra();
return std::make_unique<SYCLInternalLinearAlgebra>();
}

ALIEN_EXPORT IInternalLinearAlgebraExpr<SYCLBEllPackMatrix<Real>, SYCLVector<Real>>*
ALIEN_EXPORT std::unique_ptr<IInternalLinearAlgebraExpr<SYCLBEllPackMatrix<Real>, SYCLVector<Real>>>
SYCLInternalLinearAlgebraExprFactory()
{
return new SYCLInternalLinearAlgebraExpr();
return std::make_unique<SYCLInternalLinearAlgebraExpr>();
}

/*---------------------------------------------------------------------------*/
Expand Down
36 changes: 18 additions & 18 deletions src/core/alien/kernels/sycl/algebra/SYCLInternalLinearAlgebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,28 @@ class SYCLInternalLinearAlgebraExpr

public:
// IInternalLinearAlgebra interface.
Real norm0(const Vector& x) const;
Real norm1(const Vector& x) const;
Real norm2(const Vector& x) const;
void mult(const Matrix& a, const Vector& x, Vector& r) const;
void axpy(Real alpha, const Vector& x, Vector& r) const;
void aypx(Real alpha, Vector& y, const Vector& x) const;
void copy(const Vector& x, Vector& r) const;
Real dot(const Vector& x, const Vector& y) const;
void scal(Real alpha, Vector& x) const;
void diagonal(const Matrix& a, Vector& x) const;
void reciprocal(Vector& x) const;
void pointwiseMult(const Vector& x, const Vector& y, Vector& w) const;
Real norm0(const Vector& x) const override;
Real norm1(const Vector& x) const override;
Real norm2(const Vector& x) const override;
void mult(const Matrix& a, const Vector& x, Vector& r) const override;
void axpy(Real alpha, const Vector& x, Vector& r) const override;
void aypx(Real alpha, Vector& y, const Vector& x) const override;
void copy(const Vector& x, Vector& r) const override;
Real dot(const Vector& x, const Vector& y) const override;
void scal(Real alpha, Vector& x) const override;
void diagonal(const Matrix& a, Vector& x) const override;
void reciprocal(Vector& x) const override;
void pointwiseMult(const Vector& x, const Vector& y, Vector& w) const override;

// IInternalLinearAlgebra interface.

void mult(const Matrix& a, const UniqueArray<Real>& x, UniqueArray<Real>& r) const;
void axpy(Real alpha, UniqueArray<Real> const& x, UniqueArray<Real>& r) const;
void aypx(Real alpha, UniqueArray<Real>& y, UniqueArray<Real> const& x) const;
void copy(const UniqueArray<Real>& x, UniqueArray<Real>& r) const;
Real dot(Integer local_size, const UniqueArray<Real>& x, const UniqueArray<Real>& y) const;
void mult(const Matrix& a, const UniqueArray<Real>& x, UniqueArray<Real>& r) const override;
void axpy(Real alpha, UniqueArray<Real> const& x, UniqueArray<Real>& r) const override;
void aypx(Real alpha, UniqueArray<Real>& y, UniqueArray<Real> const& x) const override;
void copy(const UniqueArray<Real>& x, UniqueArray<Real>& r) const override;
Real dot(Integer local_size, const UniqueArray<Real>& x, const UniqueArray<Real>& y) const override;

void scal(Real alpha, UniqueArray<Real>& x) const;
void scal(Real alpha, UniqueArray<Real>& x) const override;

private:
std::unique_ptr<SYCLInternal::KernelInternal> m_internal;
Expand Down

0 comments on commit aa2b050

Please sign in to comment.