omp-walther
StefanoPetrilli 2 years ago
parent 1aca17cd44
commit 7cfe198d0f

@ -52,7 +52,7 @@
#ifndef _matchboxpC_H_ #ifndef _matchboxpC_H_
#define _matchboxpC_H_ #define _matchboxpC_H_
//Turn on a lot of debugging information with this switch: // Turn on a lot of debugging information with this switch:
//#define PRINT_DEBUG_INFO_ //#define PRINT_DEBUG_INFO_
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>
@ -66,193 +66,190 @@
using namespace std; using namespace std;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C"
{
#endif #endif
#if !defined(SERIAL_MPI) #if !defined(SERIAL_MPI)
#define MilanMpiLongInt MPI_LONG_LONG #define MilanMpiLongInt MPI_LONG_LONG
#ifndef _primitiveDataType_Definition_ #ifndef _primitiveDataType_Definition_
#define _primitiveDataType_Definition_ #define _primitiveDataType_Definition_
//Regular integer: // Regular integer:
#ifndef INTEGER_H #ifndef INTEGER_H
#define INTEGER_H #define INTEGER_H
typedef int32_t MilanInt; typedef int32_t MilanInt;
#endif #endif
//Regular long integer: // Regular long integer:
#ifndef LONG_INT_H #ifndef LONG_INT_H
#define LONG_INT_H #define LONG_INT_H
#ifdef BIT64 #ifdef BIT64
typedef int64_t MilanLongInt; typedef int64_t MilanLongInt;
typedef MPI_LONG MilanMpiLongInt; typedef MPI_LONG MilanMpiLongInt;
#else #else
typedef int32_t MilanLongInt; typedef int32_t MilanLongInt;
typedef MPI_INT MilanMpiLongInt; typedef MPI_INT MilanMpiLongInt;
#endif #endif
#endif #endif
//Regular boolean // Regular boolean
#ifndef BOOL_H #ifndef BOOL_H
#define BOOL_H #define BOOL_H
typedef bool MilanBool; typedef bool MilanBool;
#endif #endif
//Regular double and absolute value computation: // Regular double and absolute value computation:
#ifndef REAL_H #ifndef REAL_H
#define REAL_H #define REAL_H
typedef double MilanReal; typedef double MilanReal;
typedef MPI_DOUBLE MilanMpiReal; typedef MPI_DOUBLE MilanMpiReal;
inline MilanReal MilanAbs(MilanReal value) inline MilanReal MilanAbs(MilanReal value)
{ {
return fabs(value); return fabs(value);
} }
#endif #endif
//Regular float and absolute value computation: // Regular float and absolute value computation:
#ifndef FLOAT_H #ifndef FLOAT_H
#define FLOAT_H #define FLOAT_H
typedef float MilanFloat; typedef float MilanFloat;
typedef MPI_FLOAT MilanMpiFloat; typedef MPI_FLOAT MilanMpiFloat;
inline MilanFloat MilanAbsFloat(MilanFloat value) inline MilanFloat MilanAbsFloat(MilanFloat value)
{ {
return fabs(value); return fabs(value);
} }
#endif #endif
//// Define the limits: //// Define the limits:
#ifndef LIMITS_H #ifndef LIMITS_H
#define LIMITS_H #define LIMITS_H
//Integer Maximum and Minimum: // Integer Maximum and Minimum:
// #define MilanIntMax INT_MAX // #define MilanIntMax INT_MAX
// #define MilanIntMin INT_MIN // #define MilanIntMin INT_MIN
#define MilanIntMax INT32_MAX #define MilanIntMax INT32_MAX
#define MilanIntMin INT32_MIN #define MilanIntMin INT32_MIN
#ifdef BIT64 #ifdef BIT64
#define MilanLongIntMax INT64_MAX #define MilanLongIntMax INT64_MAX
#define MilanLongIntMin -INT64_MAX #define MilanLongIntMin -INT64_MAX
#else #else
#define MilanLongIntMax INT32_MAX #define MilanLongIntMax INT32_MAX
#define MilanLongIntMin -INT32_MAX #define MilanLongIntMin -INT32_MAX
#endif #endif
#endif #endif
// +INFINITY // +INFINITY
const double PLUS_INFINITY = numeric_limits<int>::infinity(); const double PLUS_INFINITY = numeric_limits<int>::infinity();
const double MINUS_INFINITY = -PLUS_INFINITY; const double MINUS_INFINITY = -PLUS_INFINITY;
//#define MilanRealMax LDBL_MAX //#define MilanRealMax LDBL_MAX
#define MilanRealMax PLUS_INFINITY #define MilanRealMax PLUS_INFINITY
#define MilanRealMin MINUS_INFINITY #define MilanRealMin MINUS_INFINITY
#endif #endif
//Function of find the owner of a ghost vertex using binary search: // Function of find the owner of a ghost vertex using binary search:
inline MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance, inline MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance,
MilanInt myRank, MilanInt numProcs); MilanInt myRank, MilanInt numProcs);
inline MilanLongInt firstComputeCandidateMate(MilanLongInt adj1, inline MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
MilanLongInt adj2, MilanLongInt adj2,
MilanLongInt* verLocInd, MilanLongInt *verLocInd,
MilanReal* edgeLocWeight); MilanReal *edgeLocWeight);
inline bool isAlreadyMatched(MilanLongInt node, inline bool isAlreadyMatched(MilanLongInt node,
MilanLongInt StartIndex, MilanLongInt StartIndex,
MilanLongInt EndIndex, MilanLongInt EndIndex,
vector <MilanLongInt> &GMate, vector<MilanLongInt> &GMate,
MilanLongInt* Mate, MilanLongInt *Mate,
map <MilanLongInt, MilanLongInt> &Ghost2LocalMap); map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
inline MilanLongInt computeCandidateMate(MilanLongInt adj1, inline MilanLongInt computeCandidateMate(MilanLongInt adj1,
MilanLongInt adj2, MilanLongInt adj2,
MilanReal* edgeLocWeight, MilanReal *edgeLocWeight,
MilanLongInt k, MilanLongInt k,
MilanLongInt* verLocInd, MilanLongInt *verLocInd,
MilanLongInt StartIndex, MilanLongInt StartIndex,
MilanLongInt EndIndex, MilanLongInt EndIndex,
vector <MilanLongInt> &GMate, vector<MilanLongInt> &GMate,
MilanLongInt* Mate, MilanLongInt *Mate,
map <MilanLongInt, MilanLongInt> &Ghost2LocalMap); map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge, inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt StartIndex, MilanLongInt EndIndex, MilanLongInt StartIndex, MilanLongInt EndIndex,
MilanLongInt* numGhostEdgesPtr, MilanLongInt *numGhostEdgesPtr,
MilanLongInt* numGhostVerticesPtr, MilanLongInt *numGhostVerticesPtr,
MilanLongInt* S, MilanLongInt *S,
MilanLongInt* verLocInd, MilanLongInt *verLocInd,
MilanLongInt* verLocPtr, MilanLongInt *verLocPtr,
omp_lock_t* MateLock, omp_lock_t *MateLock,
map <MilanLongInt, MilanLongInt> &Ghost2LocalMap, map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
vector <MilanLongInt>& Counter, vector<MilanLongInt> &Counter,
vector <MilanLongInt>& verGhostPtr, vector<MilanLongInt> &verGhostPtr,
vector <MilanLongInt>& verGhostInd, vector<MilanLongInt> &verGhostInd,
vector <MilanLongInt>& tempCounter, vector<MilanLongInt> &tempCounter,
vector <MilanLongInt>& GMate, vector<MilanLongInt> &GMate,
vector<MilanLongInt>& Message, vector<MilanLongInt> &Message,
vector<MilanLongInt>& QLocalVtx, vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt>& QGhostVtx, vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt>& QMsgType, vector<MilanLongInt> &QMsgType,
vector<MilanInt>& QOwner, vector<MilanInt> &QOwner,
MilanLongInt* &candidateMate, MilanLongInt *&candidateMate,
staticQueue& U, staticQueue &U,
staticQueue& privateU, staticQueue &privateU,
staticQueue& privateQLocalVtx, staticQueue &privateQLocalVtx,
staticQueue& privateQGhostVtx, staticQueue &privateQGhostVtx,
staticQueue& privateQMsgType, staticQueue &privateQMsgType,
staticQueue& privateQOwner staticQueue &privateQOwner);
);
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
( MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanReal *edgeLocWeight,
MilanLongInt* verLocPtr, MilanLongInt* verLocInd, MilanReal* edgeLocWeight, MilanLongInt *verDistance,
MilanLongInt* verDistance, MilanLongInt *Mate,
MilanLongInt* Mate, MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm, MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent, MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time, MilanLongInt *ph1_card, MilanLongInt *ph2_card);
MilanLongInt* ph1_card, MilanLongInt* ph2_card );
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
( MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanReal *edgeLocWeight,
MilanLongInt* verLocPtr, MilanLongInt* verLocInd, MilanReal* edgeLocWeight, MilanLongInt *verDistance,
MilanLongInt* verDistance, MilanLongInt *Mate,
MilanLongInt* Mate, MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm, MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent, MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time, MilanLongInt *ph1_card, MilanLongInt *ph2_card);
MilanLongInt* ph1_card, MilanLongInt* ph2_card );
void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
( MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanFloat *edgeLocWeight,
MilanLongInt* verLocPtr, MilanLongInt* verLocInd, MilanFloat* edgeLocWeight, MilanLongInt *verDistance,
MilanLongInt* verDistance, MilanLongInt *Mate,
MilanLongInt* Mate, MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
MilanInt myRank, MilanInt numProcs, MPI_Comm comm, MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent, MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time, MilanLongInt *ph1_card, MilanLongInt *ph2_card);
MilanLongInt* ph1_card, MilanLongInt* ph2_card );
void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt* verLocPtr, MilanLongInt* verLocInd, MilanReal* edgeLocWeight, MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanReal *edgeLocWeight,
MilanLongInt* verDistance, MilanLongInt *verDistance,
MilanLongInt* Mate, MilanLongInt *Mate,
MilanInt myRank, MilanInt numProcs, MilanInt icomm, MilanInt myRank, MilanInt numProcs, MilanInt icomm,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent, MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time, MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanLongInt* ph1_card, MilanLongInt* ph2_card ); MilanLongInt *ph1_card, MilanLongInt *ph2_card);
void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge, void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt* verLocPtr, MilanLongInt* verLocInd, MilanFloat* edgeLocWeight, MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanFloat *edgeLocWeight,
MilanLongInt* verDistance, MilanLongInt *verDistance,
MilanLongInt* Mate, MilanLongInt *Mate,
MilanInt myRank, MilanInt numProcs, MilanInt icomm, MilanInt myRank, MilanInt numProcs, MilanInt icomm,
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent, MilanReal* msgPercent, MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time, MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
MilanLongInt* ph1_card, MilanLongInt* ph2_card ); MilanLongInt *ph1_card, MilanLongInt *ph2_card);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

Loading…
Cancel
Save