Commit f1b37089 authored by COULAUD Olivier's avatar COULAUD Olivier

Merge branch 'fix-build-clang' into 'develop'

Fix build clang

See merge request solverstack/ScalFMM!13
parents c2c348ad 177c3370
......@@ -165,6 +165,11 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_
# -xHost -mfpmath=sse
# -Wall Wnosign-conversion
#
# Set a fixed template depth
# Compilers don't use the same default for template-depth, we can enforce the same one everywhere.
# The magic number comes from GCC's default: https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -ftemplate-depth=900")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# INTEL
IF (APPLE)
......
......@@ -333,18 +333,12 @@ public:
std::array<multipole_t*, node_t::child_count> child_multipoles {};
std::transform(std::begin(node->getChildren()), std::end(node->getChildren()),
child_multipoles.begin(),
[](node_t* n) {
return n == nullptr ? nullptr
: &(n->getData()->getMultipoleData());
});
node_t::template getMultipoleDataFromNode<node_t, multipole_t>);
std::array<symbolic_data_t*, node_t::child_count> child_symbolics {};
std::transform(std::begin(node->getChildren()), std::end(node->getChildren()),
child_symbolics.begin(),
[](node_t* n) {
return n == nullptr ? nullptr
: &(n->getSymbolicData());
});
node_t::template getSymbolicData<node_t, symbolic_data_t>);
// Call kernel module
this->_kernels[thread_num]->M2M(
......@@ -863,18 +857,11 @@ public:
std::array<local_expansion_t*, node_t::child_count> child_local_expansions {};
std::transform(std::begin(node->getChildren()), std::end(node->getChildren()),
child_local_expansions.begin(),
[](node_t* n) {
return n == nullptr ? nullptr
: &(n->getData()->getLocalExpansionData());
});
node_t::template getLocalExpansionDataFromNode<node_t, local_expansion_t>);
std::array<symbolic_data_t*, node_t::child_count> child_symbolics {};
std::transform(std::begin(node->getChildren()), std::end(node->getChildren()),
child_symbolics.begin(),
[](node_t* n) {
return n == nullptr ? nullptr
: &(n->getSymbolicData());
});
node_t::template getSymbolicDataFromNode<node_t, symbolic_data_t>);
this->_kernels[thread_num]->L2L(
&(node->getData()->getLocalExpansionData()),
......
......@@ -983,6 +983,24 @@ private:
inria::make_index_sequence<std::tuple_size<Tuple>::value - Dim>{});
}
template<typename Node, typename Multipole>
static Multipole *getMultipoleDataFromNode(Node *n) {
return n == nullptr ? nullptr
: &(n->getData()->getMultipoleData());
}
template<typename Node, typename SymbolicData>
static SymbolicData *getSymbolicDataFromNode(Node *n) {
return n == nullptr ? nullptr
: &(n->getSymbolicData());
}
template<typename Node, typename LocalExpansion>
static LocalExpansion *getLocalExpansionDataFromNode(Node *n) {
return n == nullptr ? nullptr
: &(n->getData()->getLocalExpansionData());
}
/**
* \brief Reinsert particle in tree after spliting a container
*
......
......@@ -91,6 +91,26 @@ public:
/** Do nothing */
void resetToInitialState(){
}
template<typename CellClass, typename Multipole>
static Multipole *getMultipoleDataFromCell(CellClass *c) {
return c == nullptr ? nullptr
: &(c->getMultipoleData());
}
template<typename CellClass, typename LocalExpansion>
static LocalExpansion *getLocalExpansionDataFromCell(CellClass *c) {
return c == nullptr ? nullptr
: &(c->getLocalExpansionData());
}
// FIXME: see Src/Core/FFmmAlgorithmSectionTask.hpp for usage
// This is applied via std::transform to an array of data.
// It doesn't seem to do anything, but I may be missing something.
template<typename CellClass>
static CellClass *identity(CellClass *c) {
return c;
}
};
......
......@@ -302,7 +302,7 @@ public:
--idx;
}
removed.push_back(indicesToRemove[i]);
FBase::erase(this->begin()+idx);
FBase::erase(this->cbegin()+idx);
}
}
......
......@@ -18,6 +18,8 @@
#include "../Containers/FOctree.hpp"
#include "../Containers/FVector.hpp"
#include "Components/FBasicCell.hpp"
#include "FCoreCommon.hpp"
#include "FP2PExclusion.hpp"
......@@ -217,13 +219,10 @@ protected:
CellClass** children = octreeIterator.getCurrentChildren();
std::array<const multipole_t*, 8> child_multipoles;
std::transform(children, children+8, child_multipoles.begin(),
[](CellClass* c) {
return (c == nullptr ? nullptr
: &(c->getMultipoleData()));
});
FBasicCell::getMultipoleDataFromCell<const CellClass, const multipole_t>);
std::array<const symbolic_data_t*, 8> child_symbolics;
std::transform(children, children+8, child_symbolics.begin(),
[](CellClass* c) {return c;});
FBasicCell::identity<const CellClass>);
kernels[omp_get_thread_num()]->M2M(parent_multipole,
parent_symbolic,
child_multipoles.data(),
......@@ -286,7 +285,7 @@ protected:
do{
const int counter = tree->getInteractionNeighbors(neighbors, neighborPositions, octreeIterator.getCurrentGlobalCoordinate(), idxLevel, separationCriteria);
if(counter){
#pragma omp task firstprivate(octreeIterator, neighbors, neighborPositions, counter,idxLevel)
#pragma omp task firstprivate(octreeIterator, neighbors, neighborPositions, counter, idxLevel, kernels)
{
local_expansion_t* const target_local_exp
= &(octreeIterator.getCurrentCell()->getLocalExpansionData());
......@@ -294,13 +293,10 @@ protected:
= octreeIterator.getCurrentCell();
std::array<const multipole_t*, 342> neighbor_multipoles;
std::transform(neighbors, neighbors+counter, neighbor_multipoles.begin(),
[](const CellClass* c) {
return (c == nullptr ? nullptr
: &(c->getMultipoleData()));
});
FBasicCell::getMultipoleDataFromCell<const CellClass, const multipole_t>);
std::array<const symbolic_data_t*, 342> neighbor_symbolics;
std::transform(neighbors, neighbors+counter, neighbor_symbolics.begin(),
[](const CellClass* c) {return c;});
FBasicCell::identity<const CellClass>);
kernels[omp_get_thread_num()]->M2L(
target_local_exp,
......@@ -365,13 +361,10 @@ protected:
= octreeIterator.getCurrentCell();
std::array<const multipole_t*, 342> neighbor_multipoles;
std::transform(neighbors, neighbors+counter, neighbor_multipoles.begin(),
[](const CellClass* c) {
return (c == nullptr ? nullptr
: &(c->getMultipoleData()));
});
FBasicCell::getMultipoleDataFromCell<const CellClass, const multipole_t>);
std::array<const symbolic_data_t*, 342> neighbor_symbolics;
std::transform(neighbors, neighbors+counter, neighbor_symbolics.begin(),
[](const CellClass* c) {return c;});
FBasicCell::identity<const CellClass>);
kernels[omp_get_thread_num()]->M2L(
target_local_exp,
......@@ -427,12 +420,10 @@ protected:
CellClass** children = octreeIterator.getCurrentChildren();
std::array<local_expansion_t*, 8> child_local_expansions;
std::transform(children, children+8, child_local_expansions.begin(),
[](CellClass* c) {return (c == nullptr ? nullptr
: &(c->getLocalExpansionData()));
});
FBasicCell::getLocalExpansionDataFromCell<CellClass, local_expansion_t>);
std::array<symbolic_data_t*, 8> child_symbolics;
std::transform(children, children+8, child_symbolics.begin(),
[](CellClass* c) {return c;});
FBasicCell::identity<CellClass>);
kernels[omp_get_thread_num()]->L2L(
parent_local_exp,
parent_symbolic,
......
......@@ -7,18 +7,18 @@
#include <omp.h>
#include "../Utils/FGlobal.hpp"
#include "../Utils/FAssert.hpp"
#include "Utils/FLog.hpp"
#include "Utils/FEnv.hpp"
#include "Utils/FAlgorithmTimers.hpp"
#include "Utils/FAssert.hpp"
#include "Utils/FEnv.hpp"
#include "Utils/FGlobal.hpp"
#include "Utils/FLog.hpp"
#include "Utils/FTic.hpp"
#include "Utils/FAlgorithmTimers.hpp"
#include "Containers/FOctree.hpp"
#include "Containers/FVector.hpp"
#include "Components/FBasicCell.hpp"
#include "FCoreCommon.hpp"
#include "FP2PExclusion.hpp"
......@@ -349,6 +349,12 @@ protected:
}
typename OctreeClass::Iterator avoidGotoLeftIterator(octreeIterator);
// FIXME: hack around a clang bug
// it apparently can't manage a firstprivate const member
// such as 'tree', but can manage a local copy...
// getting the height first, or making 'tree' shared both
// workaround it.
OctreeClass * const treeAlias = tree;
// for each levels
for(int idxLevel = FAbstractAlgorithm::upperWorkingLevel ; idxLevel < FAbstractAlgorithm::lowerWorkingLevel ; ++idxLevel ){
......@@ -356,11 +362,11 @@ protected:
const int separationCriteria = (idxLevel != FAbstractAlgorithm::lowerWorkingLevel-1 ? 1 : leafLevelSeparationCriteria);
// for each cells
do{
#pragma omp task default(none) firstprivate(octreeIterator,separationCriteria,idxLevel)
#pragma omp task default(none) firstprivate(octreeIterator, separationCriteria, idxLevel, treeAlias, kernels)
{
const CellClass* neighbors[342];
int neighborPositions[342];
const int counter = tree->getInteractionNeighbors(
const int counter = treeAlias->getInteractionNeighbors(
neighbors, neighborPositions,
octreeIterator.getCurrentGlobalCoordinate(),
idxLevel, separationCriteria);
......@@ -374,13 +380,10 @@ protected:
= octreeIterator.getCurrentCell();
std::array<const multipole_t*, 342> neighbor_multipoles;
std::transform(neighbors, neighbors+counter, neighbor_multipoles.begin(),
[](const CellClass* c) {
return (c == nullptr ? nullptr
: &(c->getMultipoleData()));
});
FBasicCell::getMultipoleDataFromCell<const CellClass, const multipole_t>);
std::array<const symbolic_data_t*, 342> neighbor_symbolics;
std::transform(neighbors, neighbors+counter, neighbor_symbolics.begin(),
[](const CellClass* c) {return c;});
FBasicCell::identity<const CellClass>);
kernels[omp_get_thread_num()]->M2L(
target_local_exp,
......
......@@ -139,7 +139,13 @@ protected:
std::vector<BlockInteractions<ParticleGroupClass>>* externalInteractions = &externalInteractionsLeafLevel[idxGroup];
#pragma omp task default(none) firstprivate(idxGroup, containers, externalInteractions)
// FIXME: hack around a clang bug
// it apparently can't manage a firstprivate const member
// such as 'tree', but can manage a local copy...
// getting the height first, or making 'tree' shared both
// workaround it.
OctreeClass * const treeAlias = tree;
#pragma omp task default(none) firstprivate(idxGroup, containers, externalInteractions, treeAlias)
{ // Can be a task(inout:iterCells)
std::vector<OutOfBlockInteraction> outsideInteractions;
const MortonIndex blockStartIdx = containers->getStartingIndex();
......@@ -152,7 +158,7 @@ protected:
MortonIndex interactionsIndexes[26];
int interactionsPosition[26];
FTreeCoordinate coord(mindex);
int counter = coord.getNeighborsIndexes(tree->getHeight(),interactionsIndexes,interactionsPosition);
int counter = coord.getNeighborsIndexes(treeAlias->getHeight(),interactionsIndexes,interactionsPosition);
for(int idxInter = 0 ; idxInter < counter ; ++idxInter){
if( blockStartIdx <= interactionsIndexes[idxInter] && interactionsIndexes[idxInter] < blockEndIdx ){
......@@ -175,7 +181,7 @@ protected:
int currentOutInteraction = 0;
for(int idxLeftGroup = 0 ; idxLeftGroup < idxGroup && currentOutInteraction < int(outsideInteractions.size()) ; ++idxLeftGroup){
ParticleGroupClass* leftContainers = tree->getParticleGroup(idxLeftGroup);
ParticleGroupClass* leftContainers = treeAlias->getParticleGroup(idxLeftGroup);
const MortonIndex blockStartIdxOther = leftContainers->getStartingIndex();
const MortonIndex blockEndIdxOther = leftContainers->getEndingIndex();
......@@ -227,7 +233,13 @@ protected:
std::vector<BlockInteractions<CellContainerClass>>* externalInteractions = &externalInteractionsAllLevel[idxLevel][idxGroup];
#pragma omp task default(none) firstprivate(idxGroup, currentCells, idxLevel, externalInteractions)
// FIXME: hack around a clang bug
// it apparently can't manage a firstprivate const member
// such as 'tree', but can manage a local copy...
// getting the height first, or making 'tree' shared both
// workaround it.
OctreeClass * const treeAlias = tree;
#pragma omp task default(none) firstprivate(idxGroup, currentCells, idxLevel, externalInteractions, treeAlias)
{
std::vector<OutOfBlockInteraction> outsideInteractions;
const MortonIndex blockStartIdx = currentCells->getStartingIndex();
......@@ -262,7 +274,7 @@ protected:
int currentOutInteraction = 0;
for(int idxLeftGroup = 0 ; idxLeftGroup < idxGroup && currentOutInteraction < int(outsideInteractions.size()) ; ++idxLeftGroup){
CellContainerClass* leftCells = tree->getCellGroup(idxLevel, idxLeftGroup);
CellContainerClass* leftCells = treeAlias->getCellGroup(idxLevel, idxLeftGroup);
const MortonIndex blockStartIdxOther = leftCells->getStartingIndex();
const MortonIndex blockEndIdxOther = leftCells->getEndingIndex();
......@@ -377,7 +389,7 @@ protected:
nbSubCellGroups += 1;
}
#pragma omp task default(none) firstprivate(idxLevel, currentCells, subCellGroups, nbSubCellGroups)
#pragma omp task default(none) firstprivate(idxLevel, currentCells, subCellGroups, nbSubCellGroups, kernels)
{
KernelClass*const kernel = kernels[omp_get_thread_num()];
int idxSubCellGroup = 0;
......@@ -452,7 +464,7 @@ protected:
while(iterCells != endCells){
CellContainerClass* currentCells = (*iterCells);
#pragma omp task default(none) firstprivate(currentCells, idxLevel)
#pragma omp task default(none) firstprivate(currentCells, idxLevel, kernels)
{
const MortonIndex blockStartIdx = currentCells->getStartingIndex();
const MortonIndex blockEndIdx = currentCells->getEndingIndex();
......@@ -527,7 +539,7 @@ protected:
CellContainerClass* cellsOther = (*currentInteractions).otherBlock;
const std::vector<OutOfBlockInteraction>* outsideInteractions = &(*currentInteractions).interactions;
#pragma omp task default(none) firstprivate(currentCells, outsideInteractions, cellsOther, idxLevel)
#pragma omp task default(none) firstprivate(currentCells, outsideInteractions, cellsOther, idxLevel, kernels)
{
KernelClass*const kernel = kernels[omp_get_thread_num()];
......@@ -622,7 +634,7 @@ protected:
nbSubCellGroups += 1;
}
#pragma omp task default(none) firstprivate(idxLevel, currentCells, subCellGroups, nbSubCellGroups)
#pragma omp task default(none) firstprivate(idxLevel, currentCells, subCellGroups, nbSubCellGroups, kernels)
{
KernelClass*const kernel = kernels[omp_get_thread_num()];
int idxSubCellGroup = 0;
......@@ -691,7 +703,13 @@ protected:
while(iterParticles != endParticles){
ParticleGroupClass* containers = (*iterParticles);
#pragma omp task default(none) firstprivate(containers)
// FIXME: hack around a clang bug
// it apparently can't manage a firstprivate const member
// such as 'tree', but can manage a local copy...
// getting the height first, or making 'tree' shared both
// workaround it.
OctreeClass * const treeAlias = tree;
#pragma omp task default(none) firstprivate(containers, kernels, treeAlias)
{
const MortonIndex blockStartIdx = containers->getStartingIndex();
const MortonIndex blockEndIdx = containers->getEndingIndex();
......@@ -704,7 +722,7 @@ protected:
MortonIndex interactionsIndexes[26];
int interactionsPosition[26];
FTreeCoordinate coord(mindex);
int counter = coord.getNeighborsIndexes(tree->getHeight(),interactionsIndexes,interactionsPosition);
int counter = coord.getNeighborsIndexes(treeAlias->getHeight(),interactionsIndexes,interactionsPosition);
ParticleContainerClass interactionsObjects[26];
ParticleContainerClass* interactions[26];
......@@ -747,7 +765,7 @@ protected:
ParticleGroupClass* containersOther = (*currentInteractions).otherBlock;
const std::vector<OutOfBlockInteraction>* outsideInteractions = &(*currentInteractions).interactions;
#pragma omp task default(none) firstprivate(containers, containersOther, outsideInteractions)
#pragma omp task default(none) firstprivate(containers, containersOther, outsideInteractions, kernels)
{
KernelClass*const kernel = kernels[omp_get_thread_num()];
for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){
......@@ -789,7 +807,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
CellContainerClass* leafCells = tree->getCellGroup(tree->getHeight()-1, idxGroup);
ParticleGroupClass* containers = tree->getParticleGroup(idxGroup);
#pragma omp task default(shared) firstprivate(leafCells, containers)
#pragma omp task default(shared) firstprivate(leafCells, containers, kernels)
{
KernelClass*const kernel = kernels[omp_get_thread_num()];
......
......@@ -1228,7 +1228,7 @@ public:
*/
void resize(size_type count, const value_type& values) {
if(count < this->size()) {
this->erase(this->begin() + count, this->end());
this->erase(this->cbegin() + count, this->cend());
} else if(count > this->size()) {
this->insert(this->end(), count - this->size(), values);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment