MeDiPack  1.3.0
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
adToolPassive.hpp
Go to the documentation of this file.
1/*
2 * MeDiPack, a Message Differentiation Package
3 *
4 * Copyright (C) 2015-2024 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://scicomp.rptu.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of MeDiPack (http://scicomp.rptu.de/software/codi).
11 *
12 * MeDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation, either
15 * version 3 of the License, or (at your option) any later version.
16 *
17 * MeDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU
23 * Lesser General Public License along with MeDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Authors: Max Sagebaum, Tim Albring (SciComp, University of Kaiserslautern-Landau)
27 */
28
29#pragma once
30
31#include "adToolInterface.h"
32#include "macros.h"
33#include "typeDefinitions.h"
34
38namespace medi {
39
45 class ADToolPassive final : public ADToolBase<ADToolPassive, void, void, void> {
46 public:
47
48 typedef void PrimalType;
49 typedef void AdjointType;
50 typedef void IndexType;
51
52 ADToolPassive(MPI_Datatype primalType, MPI_Datatype adjointType) :
53 ADToolBase<ADToolPassive, void, void, void>(primalType, adjointType)
54 {}
55
56 inline bool isActiveType() const {return false;}
57 inline bool isHandleRequired() const {return false;}
58 inline bool isModifiedBufferRequired() const {return false;}
59 inline bool isOldPrimalsRequired() const {return false;}
60 inline void startAssembly(HandleBase* h) const {MEDI_UNUSED(h);}
61 inline void stopAssembly(HandleBase* h) const {MEDI_UNUSED(h);}
62 inline void addToolAction(HandleBase* h) const {MEDI_UNUSED(h);}
63
64 inline AMPI_Op convertOperator(AMPI_Op op) const {
65 return op;
66 }
67
68 inline void createPrimalTypeBuffer(PrimalType* &buf, size_t size) const {
69 MEDI_UNUSED(size);
70
71 buf = nullptr;
72 }
73
74 inline void createIndexTypeBuffer(IndexType* &buf, size_t size) const {
75 MEDI_UNUSED(size);
76
77 buf = nullptr;
78 }
79
80 inline void deletePrimalTypeBuffer(PrimalType* &buf) const {
81 buf = nullptr;
82 }
83
84 inline void deleteIndexTypeBuffer(IndexType* &buf) const {
85 buf = nullptr;
86 }
87 };
88}
Definition adToolInterface.h:294
Implementation for the AD tool interface of a type that is no AD type.
Definition adToolPassive.hpp:45
bool isHandleRequired() const
The handle needs to be created if an adjoint action is required by the AD tool.
Definition adToolPassive.hpp:57
bool isModifiedBufferRequired() const
Indicates if the AD tool needs to modify the buffer in order to send the correct data.
Definition adToolPassive.hpp:58
void createIndexTypeBuffer(IndexType *&buf, size_t size) const
Create an array for the index variables.
Definition adToolPassive.hpp:74
void stopAssembly(HandleBase *h) const
Indicates to the AD tool that an adjoint action is beeing finished.
Definition adToolPassive.hpp:61
AMPI_Op convertOperator(AMPI_Op op) const
Convert the mpi intrinsic operators like MPI_SUM to the specific one for the AD tool.
Definition adToolPassive.hpp:64
void createPrimalTypeBuffer(PrimalType *&buf, size_t size) const
Create an array for the passive variables.
Definition adToolPassive.hpp:68
ADToolPassive(MPI_Datatype primalType, MPI_Datatype adjointType)
Definition adToolPassive.hpp:52
void IndexType
Definition adToolPassive.hpp:50
void AdjointType
Definition adToolPassive.hpp:49
bool isOldPrimalsRequired() const
Indicates if MeDiPack needs store the overwritten primal values for the AD tool.
Definition adToolPassive.hpp:59
void PrimalType
Definition adToolPassive.hpp:48
bool isActiveType() const
If this AD interface represents an AD type.
Definition adToolPassive.hpp:56
void addToolAction(HandleBase *h) const
Register the handle so that the AD tool can evaluate it in the reverse sweep.
Definition adToolPassive.hpp:62
void deleteIndexTypeBuffer(IndexType *&buf) const
Delete the array of the index variables.
Definition adToolPassive.hpp:84
void deletePrimalTypeBuffer(PrimalType *&buf) const
Delete the array of the passive variables.
Definition adToolPassive.hpp:80
void startAssembly(HandleBase *h) const
Indicates to the AD tool that an adjoint action is in the progress of beeing recorded.
Definition adToolPassive.hpp:60
#define MEDI_UNUSED(name)
Definition macros.h:108
Global namespace for MeDiPack - Message Differentiation Package.
Definition adjointInterface.hpp:37
Structure for the special handling of the MPI_Op structure.
Definition op.hpp:50
Definition typeDefinitions.h:53