constexpr removed from kernel execution

This commit is contained in:
hamidrezanorouzi 2023-05-06 13:51:03 +03:30
parent 06a431f689
commit 709c5263b1
4 changed files with 23 additions and 15 deletions

View File

@ -380,10 +380,13 @@ bool pFlow::sphereParticles::insertParticles
return false;
}
auto exclusionListAllPtr = getFieldObjectList();
auto newInsertedPtr = pStruct().insertPoints( position, setField, time(), exclusionListAllPtr());
if(!newInsertedPtr)
{
fatalErrorInFunction<<

View File

@ -544,18 +544,21 @@ public:
resize(maxInd+1);
}
if constexpr (isHostAccessible_)
{
fillSelected(deviceVectorAll(), indices.hostView(), indices.size(), val);
return true;
}else
{
fillSelected(deviceVectorAll(), indices.deviceView(), indices.size(), val);
return true;
}
using policy = Kokkos::RangePolicy<
execution_space,
Kokkos::IndexType<int32> >;
auto dVec = deviceVectorAll();
auto dIndex = indices.deviceView();
return false;
Kokkos::parallel_for(
"insertSetElement",
policy(0,indices.size()), LAMBDA_HD(int32 i){
dVec(dIndex(i))= val;
});
Kokkos::fence();
return true;
}
INLINE_FUNCTION_H
@ -597,13 +600,11 @@ public:
bool insertSetElement(const int32IndexContainer& indices, const Vector<T>& vals)
{
//Info<<"start of insertSetElement vecotsingle"<<endInfo;
if(indices.size() == 0)return true;
if(indices.size() != vals.size())return false;
auto maxInd = indices.max();
/*output<<"maxInd "<< maxInd<<endl;
output<<"size() "<< size()<<endl;*/
if(this->empty() || maxInd > size()-1 )
{
resize(maxInd+1);

View File

@ -158,6 +158,7 @@ void* pFlow::setFieldEntry::setPointFieldSelected
if( pointField<VectorDual,Type>::TYPENAME() == fieldTypeName )
{
auto& field = owner.lookupObject<pointField<VectorDual,Type>>(fName);
if(field.insertSetElement(selected, value))
return &field;

View File

@ -379,11 +379,13 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
pos)
)return nullptr;
if(!pointFlag_.insertSetElement(
newPointsPtr(),
static_cast<int8>(PointFlag::ACTIVE))
)return nullptr;
setNumMaxPoints();
auto minInd = newPointsPtr().min();
auto maxInd = newPointsPtr().max();
@ -393,6 +395,7 @@ pFlow::uniquePtr<pFlow::int32IndexContainer> pFlow::pointStructure::insertPoints
for(auto sfEntry:setField)
{
if(void* fieldPtr =
sfEntry.setPointFieldSelectedAll(
owner,