Commit 9a901bf0 authored by BRAMAS Berenger's avatar BRAMAS Berenger
parents e4b0b686 e5f1f699
......@@ -1016,6 +1016,27 @@ extern "C" int scalfmm_get_nb_timers(scalfmm_handle Handle){
// ((ScalFmmCoreHandle<double> * ) Handle)->engine->tree_abstract_insert(NbPartToInsert,nbAttributeToInsert,strideForEachAtt,rawDatas);
// }
/**
* These functions are just translating functions.
*/
//< This function fill the childFullPosition[3] with [-1;1] to know the position of a child relatively to
//< its position from its parent
extern "C" void scalfmm_utils_parentChildPosition(int childPosition, int* childFullPosition){
childFullPosition[2] = (childPosition%2 ? 1 : -1);
childFullPosition[1] = ((childPosition/2)%2 ? 1 : -1);
childFullPosition[0] = ((childPosition/4)%2 ? 1 : -1);
}
//< This function fill the childFullPosition[3] with [-3;3] to know the position of a interaction
//< cell relatively to its position from the target
extern "C" void scalfmm_utils_interactionPosition(int interactionPosition, int* srcPosition){
srcPosition[2] = interactionPosition%7 - 3;
srcPosition[1] = (interactionPosition/7)%7 - 3;
srcPosition[0] = (interactionPosition/49)%7 - 3;
}
extern "C" void scalfmm_reset_tree(scalfmm_handle Handle, Callback_reset_cell cellReseter){
((ScalFmmCoreHandle<double> * ) Handle)->engine->reset_tree(cellReseter);
}
......
......@@ -28,7 +28,7 @@ int main(int argc, char ** av){
double boxCenter[3] = {0.0,0.0,0.0};
//Init our lib
scalfmm_handle handle = scalfmm_init(/* TreeHeight,boxWidth,boxCenter, */myChoice); //The tree is built
scalfmm_handle handle = scalfmm_init(/* TreeHeight,boxWidth,boxCenter, */myChoice,multi_thread); //The tree is built
struct User_Scalfmm_Cell_Descriptor user_descr;
user_descr.user_init_cell = NULL;
user_descr.user_free_cell = NULL;
......@@ -54,10 +54,10 @@ int main(int argc, char ** av){
}
//Inserting the array in the tree
scalfmm_tree_insert_particles_xyz(handle,nb_of_parts,positionsXYZ);
scalfmm_tree_insert_particles_xyz(handle,nb_of_parts,positionsXYZ,BOTH);
//Set the charge
scalfmm_set_physical_values(handle,nb_of_parts,array_of_charge);
scalfmm_set_physical_values(handle,nb_of_parts,array_of_charge,BOTH);
//Computation Part
......@@ -80,9 +80,9 @@ int main(int argc, char ** av){
scalfmm_execute_fmm(handle);
//Get the resulting forces
scalfmm_get_forces_xyz(handle,nb_of_parts,array_of_forces);
scalfmm_get_forces_xyz(handle,nb_of_parts,array_of_forces,BOTH);
//Get the resulting potential
scalfmm_get_potentials(handle,nb_of_parts,array_of_pot);
scalfmm_get_potentials(handle,nb_of_parts,array_of_pot,BOTH);
......@@ -90,7 +90,7 @@ int main(int argc, char ** av){
compute_displacement_from_forces(array_of_forces,array_of_charge,array_of_displacement,nb_of_parts);
//get position in order to display
scalfmm_get_positions_xyz(handle,nb_of_parts,positionsXYZ);
scalfmm_get_positions_xyz(handle,nb_of_parts,positionsXYZ,BOTH);
//Display forces :
{
......@@ -109,7 +109,7 @@ int main(int argc, char ** av){
}
}
//Apply displacement computed
scalfmm_add_to_positions_xyz(handle,nb_of_parts,array_of_displacement);
scalfmm_add_to_positions_xyz(handle,nb_of_parts,array_of_displacement,BOTH);
//Update Consequently the tree
scalfmm_update_tree(handle);
......
......@@ -47,7 +47,7 @@ struct MyCellDescriptor{
};
// This is our function that init a cell (struct MyCellDescriptor)
void* my_Callback_init_cell(int level, long long mortonIndex, int* coord, double* position){
void* my_Callback_init_cell(int level, long long mortonIndex, int* coord, double* position, void * kernel){
VerbosePrint("\tAllocating cell for level %d, morton index %lld, coord %d/%d/%d\n", level, mortonIndex, coord[0], coord[1], coord[2]);
struct MyCellDescriptor* cellData = (struct MyCellDescriptor*)malloc(sizeof(struct MyCellDescriptor));
memset(cellData, 0, sizeof(struct MyCellDescriptor));
......@@ -88,7 +88,7 @@ struct MyData {
// Our P2M
void my_Callback_P2M(void* cellData, FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
void my_Callback_P2M(void* cellData, FSize nbParticlesInLeaf, const FSize* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData;
my_data->countP2M += 1;
......@@ -152,7 +152,7 @@ void my_Callback_L2L(int level, void* cellData, int childPosition, void* childDa
// JUST-PUT-HERE: Your L2L
}
void my_Callback_L2P(void* cellData, FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
void my_Callback_L2P(void* cellData, FSize nbParticlesInLeaf, const FSize* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData;
my_data->countL2P += 1;
......@@ -167,7 +167,7 @@ void my_Callback_L2P(void* cellData, FSize nbParticlesInLeaf, const int* particl
}
}
void my_Callback_P2P(FSize nbParticlesInLeaf, const int* particleIndexes, FSize nbParticlesInSrc, const int* particleIndexesSrc, void* userData){
void my_Callback_P2P(FSize nbParticlesInLeaf, const FSize* particleIndexes, FSize nbParticlesInSrc, const FSize* particleIndexesSrc, void* userData){
struct MyData* my_data = (struct MyData*)userData;
my_data->countP2P += 1;
......@@ -189,7 +189,7 @@ void my_Callback_P2P(FSize nbParticlesInLeaf, const int* particleIndexes, FSize
// interacting with the target particles
}
void my_Callback_P2PInner(FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
void my_Callback_P2PInner(FSize nbParticlesInLeaf, const FSize* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData;
my_data->countP2PInner += 1;
......@@ -233,7 +233,7 @@ int main(int argc, char ** argv){
}
// Init the handle
scalfmm_handle handle = scalfmm_init(user_defined_kernel);
scalfmm_handle handle = scalfmm_init(user_defined_kernel,multi_thread);
//Build our own call backs
struct User_Scalfmm_Cell_Descriptor cellDescriptor;
......@@ -245,7 +245,7 @@ int main(int argc, char ** argv){
scalfmm_build_tree(handle,treeHeight, boxWidth, boxCenter, cellDescriptor);
// Insert particles
printf("Inserting particles...\n");
scalfmm_tree_insert_particles_xyz(handle, nbParticles, particleXYZ);
scalfmm_tree_insert_particles_xyz(handle, nbParticles, particleXYZ,BOTH);
printf("Particles Inserted ...\n");
// Init our callback struct
......@@ -253,10 +253,12 @@ int main(int argc, char ** argv){
kernel.p2m = my_Callback_P2M;
kernel.m2m = my_Callback_M2M;
kernel.m2l = my_Callback_M2L;
kernel.m2l_full = NULL;
kernel.l2l = my_Callback_L2L;
kernel.l2p = my_Callback_L2P;
kernel.p2pinner = my_Callback_P2PInner;
kernel.p2p = my_Callback_P2P;
kernel.p2p_full = NULL;
// Init the data to pass to all our callbacks
struct MyData my_data;
......@@ -277,7 +279,7 @@ int main(int argc, char ** argv){
// Execute the FMM
scalfmm_execute_fmm(handle/*, kernel, &my_data*/);
printf("FMM finished ... \n");
scalfmm_get_positions_xyz(handle,nbParticles,new_positions);
scalfmm_get_positions_xyz(handle,nbParticles,new_positions,BOTH);
//Computation on those positions
//Here it's a random
int id;
......@@ -288,7 +290,7 @@ int main(int argc, char ** argv){
}
printf("Positions changed \n");
scalfmm_set_positions_xyz(handle,nbParticles,new_positions);
scalfmm_set_positions_xyz(handle,nbParticles,new_positions,BOTH);
scalfmm_update_tree(handle);
curr_ite++;
}
......
......@@ -115,11 +115,19 @@ if( CHAMELEON_FIND_COMPONENTS )
endforeach()
endif()
set(ENV_CHAMELEON_DIR "$ENV{CHAMELEON_DIR}")
set(ENV_CHAMELEON_INCDIR "$ENV{CHAMELEON_INCDIR}")
set(ENV_CHAMELEON_LIBDIR "$ENV{CHAMELEON_LIBDIR}")
set(CHAMELEON_GIVEN_BY_USER "FALSE")
if ( CHAMELEON_DIR OR ( CHAMELEON_INCDIR AND CHAMELEON_LIBDIR) OR ENV_CHAMELEON_DIR OR (ENV_CHAMELEON_INCDIR AND ENV_CHAMELEON_LIBDIR) )
set(CHAMELEON_GIVEN_BY_USER "TRUE")
endif()
# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
# -------------------------------------------------------------------------------------
include(FindPkgConfig)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_EXECUTABLE)
if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER)
pkg_search_module(CHAMELEON chameleon)
if (NOT CHAMELEON_FIND_QUIETLY)
......@@ -162,9 +170,9 @@ if(PKG_CONFIG_EXECUTABLE)
set(CHAMELEON_LIBRARY_DIRS_DEP "${CHAMELEON_LIBRARY_DIRS}")
set(CHAMELEON_LIBRARIES_DEP "${CHAMELEON_LIBRARIES}")
endif()
endif(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR (CHAMELEON_DIR) )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR (CHAMELEON_GIVEN_BY_USER) )
if (NOT CHAMELEON_FIND_QUIETLY)
message(STATUS "Looking for CHAMELEON - PkgConfig not used")
......@@ -755,7 +763,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
set(CMAKE_REQUIRED_LIBRARIES)
endif(CHAMELEON_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR (CHAMELEON_DIR) )
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR (CHAMELEON_GIVEN_BY_USER) )
if (CHAMELEON_LIBRARIES)
if (CHAMELEON_LIBRARY_DIRS)
......
......@@ -52,11 +52,19 @@ if (NOT FXT_FOUND)
endif()
endif()
set(ENV_FXT_DIR "$ENV{FXT_DIR}")
set(ENV_FXT_INCDIR "$ENV{FXT_INCDIR}")
set(ENV_FXT_LIBDIR "$ENV{FXT_LIBDIR}")
set(FXT_GIVEN_BY_USER "FALSE")
if ( FXT_DIR OR ( FXT_INCDIR AND FXT_LIBDIR) OR ENV_FXT_DIR OR (ENV_FXT_INCDIR AND ENV_FXT_LIBDIR) )
set(FXT_GIVEN_BY_USER "TRUE")
endif()
# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
# -------------------------------------------------------------------------------------
include(FindPkgConfig)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_EXECUTABLE)
if(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER)
pkg_search_module(FXT fxt)
if (NOT FXT_FIND_QUIETLY)
......@@ -74,9 +82,9 @@ if(PKG_CONFIG_EXECUTABLE)
endif()
endif()
endif()
endif(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_DIR) )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_GIVEN_BY_USER) )
if (NOT FXT_FIND_QUIETLY)
message(STATUS "Looking for FXT - PkgConfig not used")
......@@ -269,7 +277,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR
set(CMAKE_REQUIRED_LIBRARIES)
endif(FXT_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_DIR) )
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_GIVEN_BY_USER) )
if (FXT_LIBRARIES)
if (FXT_LIBRARY_DIRS)
......
......@@ -45,6 +45,8 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
include(CheckStructHasMember)
include(CheckCSourceCompiles)
if (NOT HWLOC_FOUND)
set(HWLOC_DIR "" CACHE PATH "Installation directory of HWLOC library")
......@@ -53,11 +55,19 @@ if (NOT HWLOC_FOUND)
endif()
endif()
set(ENV_HWLOC_DIR "$ENV{HWLOC_DIR}")
set(ENV_HWLOC_INCDIR "$ENV{HWLOC_INCDIR}")
set(ENV_HWLOC_LIBDIR "$ENV{HWLOC_LIBDIR}")
set(HWLOC_GIVEN_BY_USER "FALSE")
if ( HWLOC_DIR OR ( HWLOC_INCDIR AND HWLOC_LIBDIR) OR ENV_HWLOC_DIR OR (ENV_HWLOC_INCDIR AND ENV_HWLOC_LIBDIR) )
set(HWLOC_GIVEN_BY_USER "TRUE")
endif()
# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
# -------------------------------------------------------------------------------------
include(FindPkgConfig)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_EXECUTABLE)
if( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER )
pkg_search_module(HWLOC hwloc)
if (NOT HWLOC_FIND_QUIETLY)
......@@ -75,9 +85,9 @@ if(PKG_CONFIG_EXECUTABLE)
endif()
endif()
endif()
endif( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_DIR) )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_GIVEN_BY_USER) )
if (NOT HWLOC_FIND_QUIETLY)
message(STATUS "Looking for HWLOC - PkgConfig not used")
......@@ -89,8 +99,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) O
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
set(ENV_HWLOC_DIR "$ENV{HWLOC_DIR}")
set(ENV_HWLOC_INCDIR "$ENV{HWLOC_INCDIR}")
if(ENV_HWLOC_INCDIR)
list(APPEND _inc_env "${ENV_HWLOC_INCDIR}")
elseif(ENV_HWLOC_DIR)
......@@ -164,7 +172,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) O
# Add system library paths to search lib
# --------------------------------------
unset(_lib_env)
set(ENV_HWLOC_LIBDIR "$ENV{HWLOC_LIBDIR}")
if(ENV_HWLOC_LIBDIR)
list(APPEND _lib_env "${ENV_HWLOC_LIBDIR}")
elseif(ENV_HWLOC_DIR)
......@@ -263,6 +270,13 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) O
check_function_exists(hwloc_topology_init HWLOC_WORKS)
mark_as_advanced(HWLOC_WORKS)
# test headers to guess the version
check_struct_has_member( "struct hwloc_obj" parent hwloc.h HAVE_HWLOC_PARENT_MEMBER )
check_struct_has_member( "struct hwloc_cache_attr_s" size hwloc.h HAVE_HWLOC_CACHE_ATTR )
check_c_source_compiles( "#include <hwloc.h>
int main(void) { hwloc_obj_t o; o->type = HWLOC_OBJ_PU; return 0;}" HAVE_HWLOC_OBJ_PU)
check_library_exists(${HWLOC_LIBRARIES} hwloc_bitmap_free "" HAVE_HWLOC_BITMAP)
if(NOT HWLOC_WORKS)
if(NOT HWLOC_FIND_QUIETLY)
message(STATUS "Looking for hwloc : test of hwloc_topology_init with hwloc library fails")
......@@ -276,7 +290,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) O
set(CMAKE_REQUIRED_LIBRARIES)
endif(HWLOC_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_DIR) )
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_GIVEN_BY_USER) )
if (HWLOC_LIBRARIES)
if (HWLOC_LIBRARY_DIRS)
......
......@@ -100,11 +100,19 @@ if (NOT CBLAS_FOUND)
endif()
endif()
set(ENV_MAGMA_DIR "$ENV{MAGMA_DIR}")
set(ENV_MAGMA_INCDIR "$ENV{MAGMA_INCDIR}")
set(ENV_MAGMA_LIBDIR "$ENV{MAGMA_LIBDIR}")
set(MAGMA_GIVEN_BY_USER "FALSE")
if ( MAGMA_DIR OR ( MAGMA_INCDIR AND MAGMA_LIBDIR) OR ENV_MAGMA_DIR OR (ENV_MAGMA_INCDIR AND ENV_MAGMA_LIBDIR) )
set(MAGMA_GIVEN_BY_USER "TRUE")
endif()
# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
# -------------------------------------------------------------------------------------
include(FindPkgConfig)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_EXECUTABLE)
if(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER)
pkg_search_module(MAGMA magma)
if (NOT MAGMA_FIND_QUIETLY)
......@@ -155,10 +163,10 @@ if(PKG_CONFIG_EXECUTABLE)
set(MAGMA_LIBRARY_DIRS_DEP "${MAGMA_LIBRARY_DIRS}")
set(MAGMA_LIBRARIES_DEP "${MAGMA_LIBRARIES}")
endif()
endif(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER)
# if MAGMA is not found using pkg-config
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR (MAGMA_DIR) )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR (MAGMA_GIVEN_BY_USER) )
if (NOT MAGMA_FIND_QUIETLY)
message(STATUS "Looking for MAGMA - PkgConfig not used")
......@@ -394,7 +402,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
set(CMAKE_REQUIRED_LIBRARIES)
endif(MAGMA_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR (MAGMA_DIR) )
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR (MAGMA_GIVEN_BY_USER) )
if (MAGMA_LIBRARIES)
if (MAGMA_LIBRARY_DIRS)
......
......@@ -165,12 +165,20 @@ if (NOT FXT_FOUND AND STARPU_LOOK_FOR_FXT)
endif()
endif()
set(ENV_STARPU_DIR "$ENV{STARPU_DIR}")
set(ENV_STARPU_INCDIR "$ENV{STARPU_INCDIR}")
set(ENV_STARPU_LIBDIR "$ENV{STARPU_LIBDIR}")
set(STARPU_GIVEN_BY_USER "FALSE")
if ( STARPU_DIR OR ( STARPU_INCDIR AND STARPU_LIBDIR) OR ENV_STARPU_DIR OR (ENV_STARPU_INCDIR AND ENV_STARPU_LIBDIR) )
set(STARPU_GIVEN_BY_USER "TRUE")
endif()
# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
# -------------------------------------------------------------------------------------
include(FindPkgConfig)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_EXECUTABLE)
if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
pkg_search_module(STARPU_SHM libstarpu)
set(STARPU_INCLUDE_DIRS "${STARPU_SHM_INCLUDE_DIRS}")
......@@ -241,10 +249,10 @@ if(PKG_CONFIG_EXECUTABLE)
if (STARPU_LOOK_FOR_MPI AND NOT STARPU_MPI_FOUND)
set(STARPU_FOUND "FALSE")
endif()
endif()
endif(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR (STARPU_DIR) )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR (STARPU_GIVEN_BY_USER) )
# Looking for include
# -------------------
......@@ -793,7 +801,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
set(CMAKE_REQUIRED_LIBRARIES)
endif(STARPU_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR (STARPU_DIR) )
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR (STARPU_GIVEN_BY_USER) )
if (STARPU_LIBRARIES)
if (STARPU_LIBRARY_DIRS)
......
......@@ -631,7 +631,7 @@ public:
if (ndata != typeFReal[1]){
typeFReal[1] = ndata;
}
FReal x = boxWidth *0.5;
FReal x = boxWidth * FReal(0.5);
if(this->binaryFile) {
this->writerBinaryHeader(centerOfBox,x,nbParticles,typeFReal);
}
......@@ -654,7 +654,7 @@ public:
void writeHeader(const FPoint<FReal> &centerOfBox,const FReal &boxWidth, const FSize &nbParticles,
const unsigned int dataType, const unsigned int nbDataPerRecord) {
unsigned int typeFReal[2] = {dataType , nbDataPerRecord };
FReal x = boxWidth *0.5;
FReal x = boxWidth * FReal(0.5);
if(this->binaryFile) {
this->writerBinaryHeader(centerOfBox,x,nbParticles,typeFReal);
}
......
......@@ -144,7 +144,7 @@ public:
{ 1, 1, -1},
{ 1, 1, 1} };
// Translate center if cell widths are extended
const FReal frac = (1. - ExtendedCellRatio);
const FReal frac = (FReal(1.) - ExtendedCellRatio);
ChildCenter.setX(FReal(RelativeChildPositions[ChildIndex][0]) * frac);
ChildCenter.setY(FReal(RelativeChildPositions[ChildIndex][1]) * frac);
......
......@@ -121,7 +121,7 @@ class FUnifInterpolator : FNoCopyable
FReal(FReal(ParentWidth)/FReal(2.) + CellWidthExtension) / FReal(ParentWidth + CellWidthExtension);
// Child cell width
const FReal ChildWidth(2.*ExtendedCellRatio);
const FReal ChildWidth(FReal(2.)*ExtendedCellRatio);
// loop: child cells
for (unsigned int child=0; child<8; ++child) {
......
......@@ -26,14 +26,14 @@
#include <fstream>
#include <typeinfo>
#include "../../Utils/FBlas.hpp"
#include "../../Utils/FTic.hpp"
#include "../../Utils/FDft.hpp"
#include "Utils/FBlas.hpp"
#include "Utils/FTic.hpp"
#include "Utils/FDft.hpp"
#include "../../Utils/FComplex.hpp"
#include "Utils/FComplex.hpp"
#include "./FUnifTensor.hpp"
#include "FUnifTensor.hpp"
/*! Precomputation of the 316 interactions by evaluation of the matrix kernel on the uniform grid and transformation into Fourier space.
PB: Compute() does not belong to the M2LHandler like it does in the Chebyshev kernel. This allows much nicer specialization of the M2LHandler class with respect to the homogeneity of the kernel of interaction like in the ChebyshevSym kernel.*/
......@@ -67,9 +67,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal Cel
TensorType::setNodeIdsPairs(node_ids_pairs);
// init Discrete Fourier Transformator
const int dimfft = 1; // unidim FFT since fully circulant embedding
const int steps[dimfft] = {rc};
FFft<FReal,dimfft> Dft;
Dft.buildDFT(steps);
FFftw<FReal,FComplex<FReal>,dimfft> Dft(rc);
// get first column of K via permutation
unsigned int perm[rc];
TensorType::setStoragePermutation(perm);
......@@ -178,7 +176,7 @@ class FUnifM2LHandler<FReal, ORDER,HOMOGENEOUS>
/// DFT specific
static const int dimfft = 1; // unidim FFT since fully circulant embedding
typedef FFft<FReal,dimfft> DftClass; // Fast Discrete Fourier Transformator
typedef FFftw<FReal,FComplex<FReal>,dimfft> DftClass; // Fast Discrete Fourier Transformator
DftClass Dft;
const unsigned int opt_rc; // specific to real valued kernel
......@@ -198,11 +196,8 @@ class FUnifM2LHandler<FReal, ORDER,HOMOGENEOUS>
public:
template <typename MatrixKernelClass>
FUnifM2LHandler(const MatrixKernelClass *const MatrixKernel, const unsigned int, const FReal, const int inLeafLevelSeparationCriterion = 1)
: FC(nullptr), Dft(), opt_rc(rc/2+1), LeafLevelSeparationCriterion(inLeafLevelSeparationCriterion)
: FC(nullptr), Dft(rc), opt_rc(rc/2+1), LeafLevelSeparationCriterion(inLeafLevelSeparationCriterion)
{
// init DFT
const int steps[dimfft] = {rc};
Dft.buildDFT(steps);
// initialize root node ids
TensorType::setNodeIdsDiff(node_diff);
......@@ -216,11 +211,8 @@ public:
* Copy constructor
*/
FUnifM2LHandler(const FUnifM2LHandler& other)
: FC(other.FC), Dft(), opt_rc(other.opt_rc), LeafLevelSeparationCriterion(other.LeafLevelSeparationCriterion)
: FC(other.FC), Dft(other.Dft), opt_rc(other.opt_rc), LeafLevelSeparationCriterion(other.LeafLevelSeparationCriterion)
{
// init DFT
const int steps[dimfft] = {rc};
Dft.buildDFT(steps);
// copy node_diff
memcpy(node_diff,other.node_diff,sizeof(unsigned int)*nnodes*nnodes);
}
......@@ -269,7 +261,7 @@ public:
FReal Px[rc];
FBlas::setzero(rc,Px);
// Apply forward Discrete Fourier Transform
Dft.applyIDFT(FX,Px);
Dft.applyIDFTNorm(FX,Px);
// Unapply Zero Padding
for (unsigned int j=0; j<nnodes; ++j)
x[j]+=Px[node_diff[nnodes-j-1]];
......@@ -342,7 +334,7 @@ class FUnifM2LHandler<FReal,ORDER,NON_HOMOGENEOUS>
unsigned int node_diff[nnodes*nnodes];
/// DFT specific
static const int dimfft = 1; // unidim FFT since fully circulant embedding
typedef FFft<FReal,dimfft> DftClass; // Fast Discrete Fourier Transformator
typedef FFftw<FReal,FComplex<FReal>,dimfft> DftClass; // Fast real-valued Discrete Fourier Transformator
DftClass Dft;
const unsigned int opt_rc; // specific to real valued kernel
......@@ -364,11 +356,8 @@ public:
FUnifM2LHandler(const MatrixKernelClass *const MatrixKernel, const unsigned int inTreeHeight, const FReal inRootCellWidth, const int inLeafLevelSeparationCriterion = 1)
: TreeHeight(inTreeHeight),
RootCellWidth(inRootCellWidth),
Dft(), opt_rc(rc/2+1), LeafLevelSeparationCriterion(inLeafLevelSeparationCriterion)
Dft(rc), opt_rc(rc/2+1), LeafLevelSeparationCriterion(inLeafLevelSeparationCriterion)
{
// init DFT
const int steps[dimfft] = {rc};
Dft.buildDFT(steps);
// initialize root node ids
TensorType::setNodeIdsDiff(node_diff);
......@@ -390,11 +379,8 @@ public:
: FC(other.FC),
TreeHeight(other.TreeHeight),
RootCellWidth(other.RootCellWidth),
Dft(), opt_rc(other.opt_rc), LeafLevelSeparationCriterion(other.LeafLevelSeparationCriterion)
Dft(other.Dft), opt_rc(other.opt_rc), LeafLevelSeparationCriterion(other.LeafLevelSeparationCriterion)
{
// init DFT
const int steps[dimfft] = {rc};
Dft.buildDFT(steps);
// copy node_diff
memcpy(node_diff,other.node_diff,sizeof(unsigned int)*nnodes*nnodes);
}
......@@ -455,7 +441,7 @@ public:
FReal Px[rc];
FBlas::setzero(rc,Px);
// Apply forward Discrete Fourier Transform
Dft.applyIDFT(FX,Px);
Dft.applyIDFTNorm(FX,Px);
// Unapply Zero Padding
for (unsigned int j=0; j<nnodes; ++j)
x[j]+=Px[node_diff[nnodes-j-1]];
......
......@@ -75,9 +75,9 @@ struct FUnifRoots : FNoCopyable
// NB: scale factor could be hardcoded (just as the roots)
FReal scale;
int omn = order-n-1;
if(omn%2) scale=-1.; // (-1)^(n-1-(k+1)+1)=(-1)^(omn-1)
else scale=1.;
scale/=FMath::pow(2.,order-1)*FMath::factorial<FReal>(n)*FMath::factorial<FReal>(omn);
if(omn%2) scale=FReal(-1.); // (-1)^(n-1-(k+1)+1)=(-1)^(omn-1)
else scale=FReal(1.);
scale/=FReal(FMath::pow(FReal(2.),order-1)*FMath::factorial<FReal>(n)*FMath::factorial<FReal>(omn));
// compute L
FReal L=FReal(1.);
......@@ -88,7 +88,7 @@ struct FUnifRoots : FNoCopyable
// new version (reducing round-off)
// regular grid on [-1,1] (h simplifies, only the size of the domain and a remains i.e. 2. and -1.)
L *= ((order-1)*(x+1.)-2.*m);
L *= (FReal(order-1)*(x+FReal(1.))-FReal(2.)*FReal(m));
}
}
......
......@@ -26,14 +26,14 @@
#include <fstream>
#include <typeinfo>
#include "../../Utils/FBlas.hpp"
#include "../../Utils/FTic.hpp"
#include "../../Utils/FDft.hpp"
#include "Utils/FBlas.hpp"
#include "Utils/FTic.hpp"
#include "Utils/FDft.hpp"
#include "../../Utils/FComplex.hpp"
#include "Utils/FComplex.hpp"
#include "./FUnifTensor.hpp"
#include "FUnifTensor.hpp"
/*! Precomputation of the 316 interactions by evaluation of the matrix kernel on the uniform grid and transformation into Fourier space. These interactions can be tensorial (of size ncmp) and are computed blockwise
......@@ -83,9 +83,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel,
// init Discrete Fourier Transformator
const int dimfft = 1; // unidim FFT since fully circulant embedding
const int steps[dimfft] = {rc};
FFft<FReal,dimfft> Dft;
Dft.buildDFT(steps);
FFftw<FReal,FComplex<FReal>,dimfft> Dft(rc);
// get first column of K via permutation
unsigned int perm[rc];
......@@ -208,7 +206,7 @@ class FUnifTensorialM2LHandler<FReal, ORDER,MatrixKernelClass,HOMOGENEOUS>
/// DFT specific
static const int dimfft = 1; // unidim FFT since fully circulant embedding
typedef FFft<FReal,dimfft> DftClass; // Fast Discrete Fourier Transformator
typedef FFftw<FReal,FComplex<FReal>,dimfft> DftClass; // Fast Discrete Fourier Transformator
DftClass Dft;
const unsigned int opt_rc; // specific to real valued kernel
......@@ -228,11 +226,8 @@ class FUnifTensorialM2LHandler<FReal, ORDER,MatrixKernelClass,HOMOGENEOUS>
public:
FUnifTensorialM2LHandler(const MatrixKernelClass *const MatrixKernel, const unsigned int, const FReal, const FReal inCellWidthExtension, const int inLeafLevelSeparationCriterion = 1)
: CellWidthExtension(inCellWidthExtension),
Dft(), opt_rc(rc/2+1), LeafLevelSeparationCriterion(inLeafLevelSeparationCriterion)
Dft(rc), opt_rc(rc/2+1), LeafLevelSeparationCriterion(inLeafLevelSeparationCriterion)
{
// init DFT
const int steps[dimfft] = {rc};
Dft.buildDFT(steps);
// allocate FC
FC = new FComplex<FReal>*[ncmp];
......@@ -252,12 +247,8 @@ public:
FUnifTensorialM2LHandler(const FUnifTensorialM2LHandler& other)
: FC(other.FC),
CellWidthExtension(other.CellWidthExtension),
Dft(), opt_rc(other.opt_rc), LeafLevelSeparationCriterion(other.LeafLevelSeparationCriterion)
{
// init DFT
const int steps[dimfft] = {rc};
Dft.buildDFT(steps);
Dft(other.Dft), opt_rc(other.opt_rc), LeafLevelSeparationCriterion(other.LeafLevelSeparationCriterion)
{
// copy node_diff
memcpy(node_diff,other.node_diff,sizeof(unsigned int)*nnodes*nnodes);
}
......@@ -311,7 +302,7 @@ public:
FReal Px[rc];
FBlas::setzero(rc,Px);
// Apply forward Discrete Fourier Transform
Dft.applyIDFT(FX,Px);
Dft.applyIDFTNorm(FX,Px);
// Unapply Zero Padding
for (unsigned int j=0; j<nnodes; ++j)
x[j]+=Px[node_diff[nnodes-j-1]];
......@@ -403,7 +394,7 @@ class FUnifTensorialM2LHandler<FReal,ORDER,MatrixKernelClass,NON_HOMOGENEOUS>
/// DFT specific
static const int dimfft = 1; // unidim FFT since fully circulant embedding
typedef FFft<FReal,dimfft> DftClass; // Fast Discrete Fourier Transformator
typedef FFftw<FReal,FComplex<FReal>,dimfft> DftClass; // Fast Discrete Fourier Transformator
DftClass Dft;
const unsigned int opt_rc; // specific to real valued kernel
......@@ -425,11 +416,8 @@ public:
: TreeHeight(inTreeHeight),
RootCellWidth(inRootCellWidth),
CellWidthExtension(inCellWidthExtension),
Dft(), opt_rc(rc/2+1), LeafLevelSeparationCriterion(inLeafLevelSeparationCriterion)
Dft(rc), opt_rc(rc/2+1), LeafLevelSeparationCriterion(inLeafLevelSeparationCriterion)
{
// init DFT
const int steps[dimfft] = {rc};
Dft.buildDFT(steps);
// allocate FC
FC = new FComplex<FReal>**[TreeHeight];
......@@ -454,12 +442,8 @@ public:
TreeHeight(other.TreeHeight),
RootCellWidth(other.RootCellWidth),
CellWidthExtension(other.CellWidthExtension),
Dft(), opt_rc(other.opt_rc), LeafLevelSeparationCriterion(other.LeafLevelSeparationCriterion)
Dft(other.Dft), opt_rc(other.opt_rc), LeafLevelSeparationCriterion(other.LeafLevelSeparationCriterion)
{
// init DFT
const int steps[dimfft] = {rc};
Dft.buildDFT(steps);
// copy node_diff
memcpy(node_diff,other.node_diff,sizeof(unsigned int)*nnodes*nnodes);
}
......@@ -517,7 +501,7 @@ public:
FReal Px[rc];
FBlas::setzero(rc,Px);
// Apply forward Discrete Fourier Transform
Dft.applyIDFT(FX,Px);