MeDiPack  1.3.0
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
operatorFunctions.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 "../macros.h"
32#include "op.hpp"
34
38namespace medi {
53 inline int AMPI_Op_create(MPI_User_function* user_fn, int commute, AMPI_Op* op) {
54 return op->init(user_fn, commute);
55 }
56
81 inline int AMPI_Op_create(const bool requiresPrimal, const bool requiresPrimalSend,
82 MPI_User_function* primalFunction, int primalFunctionCommute,
83 MPI_User_function* modifiedPrimalFunction, int modifiedPrimalFunctionCommute,
84 const PreAdjointOperation preAdjointOperation,
85 const PostAdjointOperation postAdjointOperation,
86 AMPI_Op* op) {
87 return op->init(requiresPrimal, requiresPrimalSend, primalFunction, primalFunctionCommute, modifiedPrimalFunction, modifiedPrimalFunctionCommute, preAdjointOperation, postAdjointOperation);
88 }
89
97 inline int AMPI_Op_free(AMPI_Op* op) {
98 return op->free();
99 }
100}
Global namespace for MeDiPack - Message Differentiation Package.
Definition adjointInterface.hpp:37
void(* PreAdjointOperation)(void *adjoints, void *primals, int count, int dim)
Definition typeDefinitions.h:49
int AMPI_Op_create(MPI_User_function *user_fn, int commute, AMPI_Op *op)
Default forward of the operator creation.
Definition operatorFunctions.hpp:53
int AMPI_Op_free(AMPI_Op *op)
Frees the operator.
Definition operatorFunctions.hpp:97
void(* PostAdjointOperation)(void *adjoints, void *primals, void *rootPrimals, int count, int dim)
Definition typeDefinitions.h:50
Structure for the special handling of the MPI_Op structure.
Definition op.hpp:50
int free()
Definition op.hpp:186
int init(const bool requiresPrimal, const bool requiresPrimalSend, MPI_User_function *primalFunction, int primalFunctionCommute, MPI_User_function *modifiedPrimalFunction, int modifiedPrimalFunctionCommute, const PreAdjointOperation preAdjointOperation, const PostAdjointOperation postAdjointOperation)
Creates an operator with a specialized adjoint handling.
Definition op.hpp:129