Commit 8c822839 authored by Florent Pruvost's avatar Florent Pruvost
parents c509e9d7 3f5897af
......@@ -92,7 +92,8 @@ typedef enum scalfmm_algorithm_config {
multi_thread = 1, /* Use the Multi thread version of Scalfmm*/
periodic = 2, /* Use the periodic version of Scalfmm*/
source_target = 3, /* USe the source/target algorithm */
adaptiv = 4 /*Temporary*/
adaptiv = 4, /*Temporary*/
mpi = 5
} scalfmm_algorithm;
......@@ -135,12 +136,36 @@ scalfmm_handle scalfmm_init( scalfmm_kernel_type KernelType,scalfmm_algorithm al
typedef void* (*Callback_init_cell)(int level, long long morton_index, int* tree_position, double* spatial_position, void * inDatas);
/**
* Function to destroy what have bee initialized by the user (should
* be give in Scalfmm_dealloc_handle)
* @brief Function to destroy what have bee initialized by the user
* (should be give in Scalfmm_dealloc_handle)
*/
typedef void (*Callback_free_cell)(void*);
/**
* @brief Callback used to know the size of userData.
* @param level current level of current cell
* @param userData Datas that will be serialize
* @param morton_index of the current cell
*/
typedef FSize (*Callback_get_cell_size)(int level, void * userDatas, long long morton_index);
/**
* @brief Callback used to serialize userdata inside an array of size
* given above.
* @param level current level of current cell
* @param userData Datas that will be serialize
* @param morton_index of the current cell
*/
typedef void (*Callback_copy_cell)(void * userDatas, FSize size, void * memoryAllocated);
/**
* @brief Callback used to initialize again userDat from what's have
* been stored inside an array with Callback_copy_cell.
*/
typedef void * (*Callback_restore_cell)(int level, void * arrayTobeRead);
/**
* @brief Structure containing user's call_backs in order to
* initialize/free the cell's user data.
......@@ -148,6 +173,9 @@ typedef void (*Callback_free_cell)(void*);
typedef struct User_Scalfmm_Cell_Descriptor{
Callback_free_cell user_free_cell;
Callback_init_cell user_init_cell;
Callback_get_cell_size user_get_size;
Callback_copy_cell user_copy_cell;
Callback_restore_cell user_restore_cell;
}Scalfmm_Cell_Descriptor;
......@@ -448,7 +476,7 @@ typedef void (*Callback_M2L_Ext)(int level, void* targetCell, void* sourceCell,
* @param sourceCell array of cell to be read
* @param userData datas specific to the user's kernel
*/
typedef void (*Callback_M2LFull)(int level, void* targetCell, void* sourceCell[343], void* userData);
typedef void (*Callback_M2LFull)(int level, void* targetCell, const int * neighborPosition, const int size, void** sourceCell, void* userData);
/**
* @brief Function to be filled by user's L2L
......@@ -482,17 +510,20 @@ typedef void (*Callback_P2P)(FSize nbParticles, const FSize* particleIndexes, FS
/**
* @brief Function to be filled by user's P2P
* @attention This function is symmetrc, thus when a call is done
* between target and cell[27], the user needs to apply the target
* field onto the 27 cells too.
* between target and neighbors cell, the user needs to apply the target
* field onto the neighbors cells too.
* @param nbParticles number of particle in current leaf
* @param particleIndexes indexes of particles currently computed
* @param sourceCell array of the neighbors source cells
* @param sourceParticleIndexes array of indices of source particles currently computed
* @param sourceNbPart array containing the number of part in each neighbors
* @param sourcePosition array containing relative position of the neighbor
* @param size : size of the arrays (thus, number of existing neighbor cell)
* @param userData datas specific to the user's kernel
*/
typedef void (*Callback_P2PFull)(FSize nbParticles, const FSize* particleIndexes,
const FSize * sourceParticleIndexes[27],FSize sourceNbPart[27], void* userData);
const FSize ** sourceParticleIndexes,FSize * sourceNbPart,
const int * sourcePosition, const int size, void* userData);
/**
......@@ -630,6 +661,10 @@ int scalfmm_get_nb_timers(scalfmm_handle handle);
*/
void scalfmm_get_timers(scalfmm_handle handle,double * Timers);
/////////////////////////////////////////////////////////////////////
/////////////// Algorithms functions /////////////////
/////////////////////////////////////////////////////////////////////
/**
* @brief Set the upper limit int the tree for applying FMM : standard
......@@ -640,5 +675,61 @@ void scalfmm_get_timers(scalfmm_handle handle,double * Timers);
*/
void scalfmm_set_upper_limit(scalfmm_handle handle, int upperLimit);
/////////////////////////////////////////////////////////////////////
/////////////// Distributed Version //////////////////
/////////////////////////////////////////////////////////////////////
#ifdef SCALFMM_USE_MPI
#warning "IS_THAT_REALLY_WORKING"
//YES
/**
* @brief Init scalfmm library with MPI
* @param Same as in Init
* @param comm Mpi Communicator
*/
scalfmm_handle scalfmm_init_distributed( scalfmm_kernel_type KernelType,scalfmm_algorithm algo, const MPI_Comm comm);
/**
* @brief Those function are to be called before the insert method
* @param Handle scalfmm_handle provided by scalfmm_init_distributed.
* @param nbPoints Number of particles (if local, then it's the number
* of particles given to that proc, if global, then it's the total
* number of particles)
* @param particleXYZ Array of Position. The size is in both case nbPoints.
* @param localArrayFilled Array that will be filled with particles
* once the partitionning done. Can be inserted with no changes.
* @param indexesFilled Array that store the global index of each part
* in the localArrayFilled.
* @param stride stride between two attributes inside attr.
* @param attr array of attribute to be distributed alongside the positions.
*/
void scalfmm_create_local_partition(scalfmm_handle handle, int nbPoints, double * particleXYZ, double ** localArrayFilled,
FSize ** indexesFilled, FSize * outputNbPoint);
void scalfmm_create_global_partition(scalfmm_handle handle, int nbPoints, double * particleXYZ, double ** localArrayFilled,
FSize ** indexesFilled, FSize * outputNbPoint);
/**
* @brief Once the partition done, one can call this fct in order to
* partition "things" following the same scheme. Note that arrays must
* be in the same order as the original parts.
* @param handle scalfmm_handle provided by scalfmm_init_distributed.
* @param nbThings number of items
* @param sizeofthing size of ONE item
* @param arrayOfThing array of items to be sorted/partitionned
* @param newArray output array
*/
void scalfmm_generic_partition(scalfmm_handle handle, FSize nbThings, size_t sizeofthing, void * arrayOfThing, void ** newArray);
/**
* @brief This fct will call delete on its arg, in order to free the
* memory allocated inside scalfmm, but given back to the user.
*/
void scalfmm_call_delete(void * array);
#endif
#endif
......@@ -832,6 +832,15 @@ public:
FAssertLF(0,"This feature is not available with Chebyshev Kernel, please use your own kernel or do not use it.\n Exiting anyways...\n");
}
virtual void create_local_partition(int nbPoints, double * particleXYZ, double ** localArrayFilled, FSize ** indexesFilled, FSize * outputNbPoint){
FAssertLF(0,"Either no MPI used or wrong initiation function called\n");
}
virtual void create_global_partition(int nbPoints, double * particleXYZ, double ** localArrayFilled, FSize ** indexesFilled, FSize * outputNbPoint){
FAssertLF(0,"Either no MPI used or wrong initiation function called\n");
}
virtual void generic_partition(FSize nbThings, size_t sizeofthing, void * arrayOfThing, void ** newArray){
FAssertLF(0,"Either no MPI used or wrong initiation function called\n");
}
};
template<class FReal>
......@@ -1057,4 +1066,21 @@ extern "C" void scalfmm_set_upper_limit(scalfmm_handle Handle, int upperLimit){
((ScalFmmCoreHandle<double> * ) Handle)->engine->set_upper_limit(upperLimit);
}
#ifdef SCALFMM_USE_MPI
extern "C" void scalfmm_create_local_partition(scalfmm_handle handle, int nbPoints, double * particleXYZ, double ** localArrayFilled,
FSize ** indexesFilled, FSize * outputNbPoint){
((ScalFmmCoreHandle<double> * ) handle)->engine->create_local_partition(nbPoints,particleXYZ,localArrayFilled,indexesFilled,outputNbPoint);
}
extern "C" void scalfmm_create_global_partition(scalfmm_handle handle, int nbPoints, double * particleXYZ, double ** localArrayFilled,
FSize ** indexesFilled, FSize * outputNbPoint){
((ScalFmmCoreHandle<double> * ) handle)->engine->create_global_partition(nbPoints,particleXYZ,localArrayFilled,indexesFilled,outputNbPoint);
}
extern "C" void scalfmm_generic_partition(scalfmm_handle handle, FSize nbThings, size_t sizeofthing, void * arrayOfThing, void ** newArray){
((ScalFmmCoreHandle<double> * ) handle)->engine->generic_partition(nbThings,sizeofthing,arrayOfThing,newArray);
}
#endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -34,27 +34,35 @@ void cheb_free_cell(void * inCell){
* @brief Wrapper to FMM operators (refer to CScalfmmApi.h to get the
* detailed descriptions)
*/
void cheb_p2m(void* cellData, FSize nbParticlesInLeaf, const FSize* particleIndexes, void* userData){
void cheb_p2m(void* cellData, FSize nbParticlesInLeaf, const FSize* particleIndexes,
void* userData){
ChebKernel_P2M(cellData,nbParticlesInLeaf,particleIndexes,userData);
}
void cheb_m2m(int level, void* parentCell, int childPosition, void* childCell, void* userData){
void cheb_m2m(int level, void* parentCell, int childPosition, void* childCell,
void* userData){
ChebKernel_M2M(level,parentCell,childPosition,childCell,userData);
}
void cheb_m2l_full(int level, void* targetCell, void* sourceCell[343], void* userData){
ChebKernel_M2L(level, targetCell, sourceCell, userData);
void cheb_m2l_full(int level, void* targetCell,const int* neighborPosition, const int size, void** sourceCell,
void* userData){
ChebKernel_M2L(level, targetCell, neighborPosition, size, sourceCell, userData);
}
void cheb_l2l(int level, void* parentCell, int childPosition, void* childCell, void* userData){
void cheb_l2l(int level, void* parentCell, int childPosition, void* childCell,
void* userData){
ChebKernel_L2L( level, parentCell, childPosition, childCell, userData);
}
void cheb_l2p(void* leafCell, FSize nbParticles, const FSize* particleIndexes, void* userData){
void cheb_l2p(void* leafCell, FSize nbParticles, const FSize* particleIndexes,
void* userData){
ChebKernel_L2P( leafCell, nbParticles, particleIndexes, userData);
}
void cheb_p2pFull(FSize nbParticles, const FSize* particleIndexes,
const FSize * sourceParticleIndexes[27], FSize sourceNbPart[27],void* userData) {
ChebKernel_P2P(nbParticles, particleIndexes, sourceParticleIndexes, sourceNbPart, userData);
const FSize ** sourceParticleIndexes, FSize* sourceNbPart,const int * sourcePosition,
const int size, void* userData) {
ChebKernel_P2P(nbParticles, particleIndexes, sourceParticleIndexes, sourceNbPart,sourcePosition,size,
userData);
}
void cheb_resetCell(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell, void * userData){
void cheb_resetCell(int level, long long morton_index, int* tree_position,
double* spatial_position, void * userCell, void * userData){
ChebCell_reset(level,morton_index,tree_position,spatial_position,userCell,userData);
}
......@@ -91,15 +99,15 @@ int main(int argc, char ** av){
printf("Creating Particles:\n");
FSize idxPart;
for(idxPart = 0 ; idxPart < nbPart ; ++idxPart){
particleXYZ[idxPart*3] = (random()/(double)(RAND_MAX))*boxWidth - boxWidth/2 + boxCenter[0];
particleXYZ[idxPart*3+1] = (random()/(double)(RAND_MAX))*boxWidth - boxWidth/2 + boxCenter[1];
particleXYZ[idxPart*3+2] = (random()/(double)(RAND_MAX))*boxWidth - boxWidth/2 + boxCenter[2];
particleXYZ[idxPart*3] = (random()/(double)(RAND_MAX))*boxWidth
- boxWidth/2 + boxCenter[0];
particleXYZ[idxPart*3+1] = (random()/(double)(RAND_MAX))*boxWidth
- boxWidth/2 + boxCenter[1];
particleXYZ[idxPart*3+2] = (random()/(double)(RAND_MAX))*boxWidth
- boxWidth/2 + boxCenter[2];
physicalValues[idxPart] = 1.0;
}
}
{//This part will write generated particles to a file at ScalFMM
//format in order to verify numercal results
/* FILE * fd = fopen("input.fma","w"); */
......@@ -171,7 +179,8 @@ int main(int argc, char ** av){
userDatas.insertedPositions = particleXYZ; // Set the position
userDatas.myPhyValues = physicalValues; // Set the physical values
//Create as many array of forces as there are threads in order to void concurrent write
//Create as many array of forces as there are threads in order to
//void concurrent write
double ** forcesToStore = malloc(sizeof(double*)*nb_threads);
//For each array, initialisation
for(idThreads=0 ; idThreads<nb_threads ; ++idThreads){
......
......@@ -68,6 +68,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
option( SCALFMM_USE_MEM_STATS "Set to ON to profile memory" OFF )
option( SCALFMM_ATTACHE_SOURCE "Set to ON to compile with -g" OFF )
option( SCALFMM_USE_ADDONS "Set to ON to compile add ons" OFF )
option( SCALFMM_USE_SIGNALS "Set to ON to catch various signal an print backtrace" OFF )
if( APPLE ) # to fix problem with GCC and avx
CMAKE_DEPENDENT_OPTION( SCALFMM_USE_SSE "Set to ON to compile with SSE support (and use intrinsec SSE P2P)" ON "CPUOPTION_SSE3;NOT CPUOPTION_AVX2" OFF )
CMAKE_DEPENDENT_OPTION( SCALFMM_USE_AVX "Set to ON to compile with AVX support (and use intrinsec AVX P2P)" OFF "CPUOPTION_AVX; NOT CPUOPTION_AVX2" OFF )
......@@ -90,6 +91,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
option( SCALFMM_STARPU_USE_COMMUTE "Set to ON to build SCALFMM with StarPU" ON )
option( SCALFMM_STARPU_USE_REDUX "Set to ON to build SCALFMM with StarPU" ON )
option( SCALFMM_STARPU_USE_PRIO "Set to ON to build SCALFMM with StarPU" ON )
option( SCALFMM_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF )
endif()
message(STATUS "AVANT ${CMAKE_CXX_COMPILER_ID}" )
if( SCALFMM_USE_MPI )
......@@ -432,14 +434,6 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
#
message( STATUS "SCALFMM_USE_STARPU = ${SCALFMM_USE_STARPU}" )
if( SCALFMM_USE_STARPU )
# No fast math with starpu
if(SCALFMM_CXX_FLAGS)
string(REPLACE "-ffast-math" " " SCALFMM_CXX_FLAGS ${SCALFMM_CXX_FLAGS})
endif()
if(SCALFMM_FLAGS_OPTI_RELEASE)
string(REPLACE "-ffast-math" " " SCALFMM_FLAGS_OPTI_RELEASE ${SCALFMM_FLAGS_OPTI_RELEASE})
endif()
# CUDA could be used with StarPU enabled
option( SCALFMM_USE_CUDA "Set to ON to use CUDA with StarPU" OFF )
message( STATUS "SCALFMM_USE_CUDA = ${SCALFMM_USE_CUDA}" )
......@@ -679,6 +673,18 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
endif(PKG_CONFIG_FOUND)
endif(SCALFMM_USE_EZTRACE)
##################################################################
#
# To catch signals
#
##################################################################
if((WIN32 OR (${CMAKE_SYSTEM_NAME} MATCHES "Windows")) AND SCALFMM_USE_SIGNALS)
# We are on Windows and we cannot catch signals
message( FATAL_ERROR "Catching the signals requieres an UNIX system." )
else()
SET(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -rdynamic")
endif()
##################################################################
# #
# END SETTING VARIABLES #
......
......@@ -130,6 +130,9 @@ protected:
for(int idx = 0 ; idx < 3 ; ++idx){
memcpy(newData + (allocatedParticles * idx), positions[idx], sizeof(FReal) * nbParticles);
positions[idx] = newData + (allocatedParticles * idx);
for(FSize idxEmpty = nbParticles ; idxEmpty < allocatedParticles ; ++idxEmpty){
positions[idx][idxEmpty] = std::numeric_limits<FReal>::max()/2;
}
}
// copy attributes
AttributeClass* startAddress = reinterpret_cast<AttributeClass*>(positions[2] + allocatedParticles);
......
......@@ -175,7 +175,7 @@ public:
struct starpu_conf conf;
FAssertLF(starpu_conf_init(&conf) == 0);
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
FStarPUFmmPriorities::Controller().init(&conf, tree->getHeight(), inKernels);
#endif
FAssertLF(starpu_init(&conf) == 0);
......@@ -1527,7 +1527,7 @@ protected:
starpu_insert_task(&p2m_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &cellHandles[tree->getHeight()-1][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2M(),
#endif
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
......@@ -1584,7 +1584,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1618,7 +1618,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1705,7 +1705,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosM2M(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -1773,7 +1773,7 @@ protected:
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2LExtern(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
......@@ -1805,7 +1805,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &idxLevel, sizeof(idxLevel),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2L(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
......@@ -1833,7 +1833,7 @@ protected:
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
STARPU_VALUE, &mode, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2LExtern(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][idxGroup].symb,
......@@ -1852,7 +1852,7 @@ protected:
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &cellHandles[idxLevel][idxGroup].intervalSize, sizeof(int),
STARPU_VALUE, &mode, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosM2LExtern(idxLevel),
#endif
STARPU_R, cellHandles[idxLevel][interactionid].symb,
......@@ -2007,7 +2007,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -2040,7 +2040,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -2092,7 +2092,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -2125,7 +2125,7 @@ protected:
0);
task->cl_arg = arg_buffer;
task->cl_arg_size = arg_buffer_size;
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
task->priority = FStarPUFmmPriorities::Controller().getInsertionPosL2L(idxLevel);
#endif
#ifdef STARPU_USE_TASK_NAME
......@@ -2152,7 +2152,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2PExtern(),
#endif
STARPU_R, particleHandles[idxGroup].symb,
......@@ -2185,7 +2185,7 @@ protected:
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &outsideInteractions, sizeof(outsideInteractions),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2PExtern(),
#endif
STARPU_R, particleHandles[idxGroup].symb,
......@@ -2212,7 +2212,7 @@ protected:
starpu_insert_task(&p2p_cl_in,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosP2P(),
#endif
STARPU_R, particleHandles[idxGroup].symb,
......@@ -2243,7 +2243,7 @@ protected:
starpu_insert_task(&l2p_cl,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &cellHandles[tree->getHeight()-1][idxGroup].intervalSize, sizeof(int),
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosL2P(),
#endif
STARPU_R, cellHandles[tree->getHeight()-1][idxGroup].symb,
......@@ -2272,7 +2272,7 @@ protected:
for(int idxGroup = 0 ; idxGroup < tree->getNbParticleGroup() ; ++idxGroup){
starpu_insert_task(&p2p_redux_read,
#ifdef STARPU_SUPPORT_SCHEDULER
#ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, FStarPUFmmPriorities::Controller().getInsertionPosL2P(),
#endif
STARPU_R, particleHandles[idxGroup].down,
......
......@@ -307,10 +307,10 @@ public:
const int idxLevel,
const std::vector<OutOfBlockInteraction>* outsideInteractions,
const int mode){
FTIME_TASKS(FTaskTimer::ScopeEvent taskTime(starpu_worker_get_id(), &taskTimeRecorder, (((currentCells->getStartingIndex()<<1) ^ cellsOther->getStartingIndex()) * 20 + idxLevel) * 8 + 3, "M2L-ext"));
KernelClass*const kernel = kernels[starpu_worker_get_id()];
if(mode == 1){
FTIME_TASKS(FTaskTimer::ScopeEvent taskTime(starpu_worker_get_id(), &taskTimeRecorder, (((currentCells->getStartingIndex()+1) * (cellsOther->getStartingIndex()+2)) * 20 + idxLevel) * 8 + 3, "M2L-ext"));
for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){
CellClass interCell = cellsOther->getUpCell((*outsideInteractions)[outInterIdx].outsideIdxInBlock);
FAssertLF(interCell.getMortonIndex() == (*outsideInteractions)[outInterIdx].outIndex);
......@@ -322,6 +322,7 @@ public:
}
}
else{
FTIME_TASKS(FTaskTimer::ScopeEvent taskTime(starpu_worker_get_id(), &taskTimeRecorder, (((currentCells->getStartingIndex()+1) * (cellsOther->getStartingIndex()+1)) * 20 + idxLevel) * 8 + 3, "M2L-ext"));
for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){
CellClass cell = cellsOther->getUpCell((*outsideInteractions)[outInterIdx].insideIdxInBlock);
FAssertLF(cell.getMortonIndex() == (*outsideInteractions)[outInterIdx].insideIndex);
......@@ -507,7 +508,7 @@ public:
void directInoutPassPerform(ParticleGroupClass* containers, ParticleGroupClass* containersOther,
const std::vector<OutOfBlockInteraction>* outsideInteractions){
FTIME_TASKS(FTaskTimer::ScopeEvent taskTime(starpu_worker_get_id(), &taskTimeRecorder, (containersOther->getStartingIndex() ^ containers->getStartingIndex())*20*8 + 6, "P2P-ext"));
FTIME_TASKS(FTaskTimer::ScopeEvent taskTime(starpu_worker_get_id(), &taskTimeRecorder, ((containersOther->getStartingIndex()+1) * (containers->getStartingIndex()+1))*20*8 + 6, "P2P-ext"));
KernelClass*const kernel = kernels[starpu_worker_get_id()];
for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){
ParticleContainerClass interParticles = containersOther->template getLeaf<ParticleContainerClass>((*outsideInteractions)[outInterIdx].outsideIdxInBlock);
......
......@@ -374,13 +374,27 @@ public:
}
};
#else // STARPU_SUPPORT_SCHEDULER
FStarPUFmmPriorities FStarPUFmmPriorities::controller;
#elif defined(SCALFMM_STARPU_USE_PRIO)// STARPU_SUPPORT_SCHEDULER
class FStarPUFmmPriorities{
static FStarPUFmmPriorities controller;
enum Priorities{
Prio_P2M = 9 - 5,
Prio_M2M = 8 - 5,
Prio_M2L_High = 7 - 5,
Prio_L2L = 6 - 5,
Prio_P2P_Big = 5 - 5,
Prio_M2L = 4 - 5,
Prio_L2P = 3 - 5,
Prio_P2P_Small = 2 - 5
};
FStarPUFmmPriorities(){
int treeHeight;
FStarPUFmmPriorities() : treeHeight(0){
}
public:
......@@ -389,46 +403,47 @@ public:
}
void init(struct starpu_conf* /*conf*/, const int /*inTreeHeight*/,
void init(struct starpu_conf* /*conf*/, const int inTreeHeight,
FStarPUKernelCapacities* /*inCapacities*/){
treeHeight = inTreeHeight;
}
int getInsertionPosP2M() const {
return 0;
return Prio_P2M;
}
int getInsertionPosM2M(const int /*inLevel*/) const {
return 0;
return Prio_M2M;
}
int getInsertionPosP2M(bool willBeSend) const {
return 0;
int getInsertionPosP2M(bool /*willBeSend*/) const {
return Prio_P2M;
}
int getInsertionPosM2M(const int /*inLevel*/, bool willBeSend) const {
return 0;
int getInsertionPosM2M(const int /*inLevel*/, bool /*willBeSend*/) const {
return Prio_M2M;
}
int getInsertionPosM2L(const int inLevel) const {
return 0;
return inLevel == treeHeight-1 ? Prio_M2L: Prio_M2L_High;
}
int getInsertionPosM2LExtern(const int inLevel) const {
return 0;
return inLevel == treeHeight-1 ? Prio_M2L : Prio_M2L_High;
}
int getInsertionPosL2L(const int inLevel) const {
return 0;
int getInsertionPosL2L(const int /*inLevel*/) const {
return Prio_L2L;
}
int getInsertionPosL2P() const {
return 0;
return Prio_L2P;
}
int getInsertionPosP2P() const {
return 0;
return Prio_P2P_Big;
}
int getInsertionPosP2PExtern() const {
return 0;
return Prio_P2P_Small;
}
};
#endif // STARPU_SUPPORT_SCHEDULER
FStarPUFmmPriorities FStarPUFmmPriorities::controller;
#endif // SCALFMM_STARPU_USE_PRIO - STARPU_SUPPORT_SCHEDULER
#endif // FSTARPUFMMPRIORITIES_HPP
......@@ -24,7 +24,7 @@
#warning StarPU Arbiter is not supported
#endif
#if (STARPU_MAJOR_VERSION >= 1) && (STARPU_MINOR_VERSION >= 3) && defined(SCALFMM_STARPU_USE_PRIO)
#if (STARPU_MAJOR_VERSION >= 1) && (STARPU_MINOR_VERSION >= 3) && defined(SCALFMM_STARPU_USE_PRIO) && !defined(SCALFMM_STARPU_FORCE_NO_SCHEDULER)
#define STARPU_SUPPORT_SCHEDULER
#else
#warning Scheduler is not supported
......
......@@ -50,14 +50,22 @@ void ChebKernelStruct_free(void * kernel);
void ChebKernel_P2M(void * leafCell, FSize nbParticles,const FSize* particleIndexes, void* kernel);
void ChebKernel_M2M(int level, void* parentCell, int childPosition, void* childCell, void* kernel);
void ChebKernel_M2L(int level, void* targetCell, void* sourceCell[343], void* kernel);
//Change here to somethong nearer M2L defined in Src/Components/FAbstractKernels.hpp
void ChebKernel_M2L(int level, void* targetCell,const int*neighborPositions,int size, void** sourceCell, void* kernel);
void ChebKernel_L2L(int level, void* parentCell, int childPosition, void* childCell, void* kernel);
void ChebKernel_L2P(void* leafCell, FSize nbParticles, const FSize* particleIndexes, void* kernel);
void ChebKernel_P2P(FSize nbParticles, const FSize* particleIndexes,
const FSize * sourceParticleIndexes[27], FSize sourceNbPart[27],void* userData);
const FSize ** sourceParticleIndexes, FSize * sourceNbPart,
const int * sourcePosition,const int size,void* userData);
void ChebCell_reset(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell, void * kernel);
FSize ChebCell_getSize(int level,void * userData, long long morton_index);
void ChebCell_copy(void * userDatas, FSize size, void * memoryAllocated);
void* ChebCell_restore(int level, void * arrayTobeRead);
typedef struct myUserDatas{
ChebKernelStruct * kernelStruct;
double * insertedPositions;
......
......@@ -211,10 +211,13 @@ public:
*/
~FUnifInterpolator()
{
for ( int l=0; l<TreeHeight; ++l)
for ( int l=0; l<TreeHeight; ++l) {
for (unsigned int child=0; child<8; ++child)
if(ChildParentInterpolator[l][child] != nullptr)
delete [] ChildParentInterpolator[l][child];
delete [] ChildParentInterpolator[l];
}
delete [] ChildParentInterpolator;
}
......
......@@ -137,6 +137,12 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@");
#cmakedefine SCALFMM_TIME_OMPTASKS
///////////////////////////////////////////////////////
// To catch signals and print backtrace
///////////////////////////////////////////////////////
#cmakedefine SCALFMM_USE_SIGNALS
///////////////////////////////////////////////////////
// To control starpu config
///////////////////////////////////////////////////////
......@@ -144,5 +150,6 @@ const std::string SCALFMMCompileLibs("@SCALFMM_COMPILE_LIBS@");
#cmakedefine SCALFMM_STARPU_USE_COMMUTE
#cmakedefine SCALFMM_STARPU_USE_REDUX
#cmakedefine SCALFMM_STARPU_USE_PRIO
#cmakedefine SCALFMM_STARPU_FORCE_NO_SCHEDULER
#endif // CONFIG_H
#ifndef FBINDING_HPP