Commit 100d7fe1 authored by berenger-bramas's avatar berenger-bramas
Browse files

With basic particle type we have a parallel octree.

Need to clean the code and refactore some parts.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@156 2616d619-271b-44dc-8df4-d4a8f33a7222
parent a67c5340
......@@ -264,7 +264,6 @@ public:
// sort QsLocal part of the array
const PivotType pivot = (PivotType(array[startIndex]) + PivotType(array[endIndex]) )/2;
printf("pivot %lld\n",pivot);
OmpBarrier( mutex, firstProc, lastProc, myThreadId);
QsLocal(array, pivot, myLeft, myRight, fixes[myThreadId].pre, fixes[myThreadId].suf);
......@@ -413,7 +412,7 @@ public:
sendToProc = fixes[currentRank].suf - sent;
}
mpiassert( MPI_Isend(&outputArray[sent + fixes[currentRank].pre], sendToProc, MPI_LONG_LONG , idxProc, 0, currentComm, &requests[iterRequest++]), __LINE__ );
mpiassert( MPI_Isend(&outputArray[sent + fixes[currentRank].pre], sendToProc * sizeof(SortType), MPI_BYTE , idxProc, 0, currentComm, &requests[iterRequest++]), __LINE__ );
sent += sendToProc;
}
}
......@@ -435,7 +434,7 @@ public:
sendToProc = fixes[currentRank].pre - sent;
}
mpiassert( MPI_Isend(&outputArray[sent], sendToProc, MPI_LONG_LONG , idxProc, 0, currentComm, &requests[iterRequest++]), __LINE__ );
mpiassert( MPI_Isend(&outputArray[sent], sendToProc * sizeof(SortType), MPI_BYTE , idxProc, 0, currentComm, &requests[iterRequest++]), __LINE__ );
sent += sendToProc;
}
}
......@@ -470,7 +469,7 @@ public:
const int firstIndex = Max(myLeft , (long int) fixesSum[idxProc].pre );
const int endIndex = Min((long int)fixesSum[idxProc + 1].pre, myRightLimit);
mpiassert( MPI_Irecv(&buffer[indexArray], endIndex - firstIndex, MPI_LONG_LONG, idxProc, 0, currentComm, &requests[iterRequest++]), __LINE__ );
mpiassert( MPI_Irecv(&buffer[indexArray], (endIndex - firstIndex) * sizeof(SortType), MPI_BYTE, idxProc, 0, currentComm, &requests[iterRequest++]), __LINE__ );
indexArray += endIndex - firstIndex;
++idxProc;
}
......@@ -504,7 +503,7 @@ public:
const int firstIndex = Max(myLeft , (long int)fixesSum[idxProc].suf );
const int endIndex = Min((long int)fixesSum[idxProc + 1].suf, myRightLimit);
mpiassert( MPI_Irecv(&buffer[indexArray], endIndex - firstIndex, MPI_LONG_LONG, idxProc, 0, currentComm, &requests[iterRequest++]), __LINE__ );
mpiassert( MPI_Irecv(&buffer[indexArray], (endIndex - firstIndex) * sizeof(SortType), MPI_BYTE, idxProc, 0, currentComm, &requests[iterRequest++]), __LINE__ );
indexArray += endIndex - firstIndex;
++idxProc;
}
......
......@@ -826,17 +826,19 @@ int main(int argc, char ** argv){
}
}
printf("Will now take my own particles from %d to %d\n",FMath::Max(myLeftLeaf-leftLeafs,0) , FMath::Max(myLeftLeaf-leftLeafs,0) + FMath::Min(myRightLeaf,totalNbLeafs - rightLeafs) - myLeftLeaf);
printf("Will now take my own particles from %d to %d\n",FMath::Max(myLeftLeaf-leftLeafs,0) , FMath::Min(nbLeafs , FMath::Max(myLeftLeaf-leftLeafs,0) + FMath::Min(myRightLeaf,totalNbLeafs - rightLeafs) - myLeftLeaf));
printf("myLeftLeaf %d leftLeafs %d myRightLeaf %d rightLeafs %d totalNbLeafs %d\n",myLeftLeaf,leftLeafs, myRightLeaf, rightLeafs, totalNbLeafs);
// insert the particles we already have
if(leftLeafs != totalNbLeafs){
for(int idxLeafInsert = FMath::Max(myLeftLeaf-leftLeafs,0) ; idxLeafInsert < FMath::Max(myLeftLeaf-leftLeafs,0) + FMath::Min(myRightLeaf,totalNbLeafs- rightLeafs) - myLeftLeaf ; ++idxLeafInsert){
for(int idxLeafInsert = FMath::Max(myLeftLeaf-leftLeafs,0) ; idxLeafInsert < FMath::Min(nbLeafs , FMath::Max(myLeftLeaf-leftLeafs,0) + FMath::Min(myRightLeaf,totalNbLeafs - rightLeafs) - myLeftLeaf) ; ++idxLeafInsert){
for(int idxPart = 0 ; idxPart < groups[idxLeafInsert].number ; ++idxPart){
realTree.insert(realParticles[groups[idxLeafInsert].positionInArray + idxPart]);
}
}
}
printf("Done\n");
delete [] reinterpret_cast<char*>(rpart);
}
......
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