Scippy

UG

Ubiquity Generator framework

scipParaInitialStatTh.cpp
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and software framework */
4/* UG --- Ubquity Generator Framework */
5/* */
6/* Copyright Written by Yuji Shinano <shinano@zib.de>, */
7/* Copyright (C) 2021-2024 by Zuse Institute Berlin, */
8/* licensed under LGPL version 3 or later. */
9/* Commercial licenses are available through <licenses@zib.de> */
10/* */
11/* This code is free software; you can redistribute it and/or */
12/* modify it under the terms of the GNU Lesser General Public License */
13/* as published by the Free Software Foundation; either version 3 */
14/* of the License, or (at your option) any later version. */
15/* */
16/* This program is distributed in the hope that it will be useful, */
17/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19/* GNU Lesser General Public License for more details. */
20/* */
21/* You should have received a copy of the GNU Lesser General Public License */
22/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
23/* */
24/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25
26/**@file scipParaInitialStatTh.cpp
27 * @brief ScipParaInitialStat extension for threads communication.
28 * @author Yuji Shinano
29 *
30 *
31 *
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36
37#include "scipParaCommTh.h"
39
40using namespace ParaSCIP;
41
42/** create ScipParaInitialStatTh */
44ScipParaInitialStatTh::createDatatype(
46 )
47{
48 return clone(comm);
49}
50
51/** send solution data to the rank */
52void
54{
55 DEF_SCIP_PARA_COMM( commTh, comm);
56
58 commTh->uTypeSend((void *)createDatatype(comm), ParaInitialStatType, destination, TagInitialStat)
59 );
60}
61
62/** receive solution data from the source rank */
63void
65{
66 DEF_SCIP_PARA_COMM( commTh, comm);
67
68 ScipParaInitialStatTh *received;
70 commTh->uTypeReceive((void **)&received, ParaInitialStatType, source, TagInitialStat)
71 );
72
73 maxDepth = received->maxDepth;
74 maxTotalDepth = received->maxTotalDepth;
81 downpscost = new SCIP_Real[nVarBranchStatsDown];
82 downvsids = new SCIP_Real[nVarBranchStatsDown];
83 downconflen = new SCIP_Real[nVarBranchStatsDown];
84 downinfer = new SCIP_Real[nVarBranchStatsDown];
85 downcutoff = new SCIP_Real[nVarBranchStatsDown];
86 uppscost = new SCIP_Real[nVarBranchStatsUp];
87 upvsids = new SCIP_Real[nVarBranchStatsUp];
88 upconflen = new SCIP_Real[nVarBranchStatsUp];
89 upinfer = new SCIP_Real[nVarBranchStatsUp];
90 upcutoff = new SCIP_Real[nVarBranchStatsUp];
91 for( int i = 0; i < nVarBranchStatsDown; i++ )
92 {
94 nVarBranchingDown[i] = received->nVarBranchingDown[i];
95 downpscost[i] = received->downpscost[i];
96 downvsids[i] = received->downvsids[i];
97 downconflen[i] = received->downconflen[i];
98 downinfer[i] = received->downinfer[i];
99 downcutoff[i] = received->downcutoff[i];
100 }
101 for( int i = 0; i < nVarBranchStatsUp; i++ )
102 {
104 nVarBranchingUp[i] = received->nVarBranchingUp[i];
105 uppscost[i] = received->uppscost[i];
106 upvsids[i] = received->upvsids[i];
107 upconflen[i] = received->upconflen[i];
108 upinfer[i] = received->upinfer[i];
109 upcutoff[i] = received->upcutoff[i];
110 }
111 delete received;
112
113}
void send(UG::ParaComm *comm, int dest)
UG::ParaInitialStat * createDatatype(UG::ParaComm *comm)
void receive(UG::ParaComm *comm, int source)
ParaInitialStat * clone(UG::ParaComm *comm)
Base class of communicator object.
Definition: paraComm.h:102
class for initial statistics collecting after racing
static ScipParaCommTh * comm
Definition: fscip.cpp:73
static const int ParaInitialStatType
static const int TagInitialStat
#define PARA_COMM_CALL(paracommcall)
Definition: paraComm.h:47
#define DEF_SCIP_PARA_COMM(scip_para_comm, comm)
SCIP ParaComm extension for threads communication.
ScipParaInitialStat extension for threads communication.