Commit d9013933 authored by ESTERIE Pierre's avatar ESTERIE Pierre

First step with cmake, units, tools, basic components

parent 8d9b6419
......@@ -6,7 +6,7 @@
url = https://gitlab.inria.fr/coulaud/inastemp.git
[submodule "experimental/modules/morse_cmake"]
path = experimental/modules/morse_cmake
url = https://gitlab.inria.fr/solverstack/morse_cmake.git
url = https://gitlab.inria.fr/solverstack/morse_cmake
[submodule "experimental/modules/xsimd"]
path = experimental/modules/xsimd
url = https://github.com/QuantStack/xsimd.git
url = https://github.com/QuantStack/xsimd
......@@ -89,7 +89,6 @@ if(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/morse_cmake"
option( SCALFMM_USE_LOG "Set to ON to print output debug information" OFF )
option( SCALFMM_USE_MEM_STATS "Set to ON to profile memory" OFF )
option( SCALFMM_ONLY_DEVEL "Set to ON to compile Development tools (only scalfmm team)" ON )
set(SCALFMM_COMPILE_DEFINITIONS "${SCALFMM_COMPILE_DEFINITIONS}" CACHE STRING "Global compile definitions for ScalFMM")
#
# Set scalfmm dev flags
......@@ -129,44 +128,39 @@ if(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/morse_cmake"
#
# XTL, XSIMD & XTENSOR
# --------------------
#if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/xsimd")
# set(xsimd_DIR "${CMAKE_CURRENT_BINARY_DIR}/modules/xsimd")
# # Find XSIMD properly
# add_subdirectory(modules/xsimd)
find_package(xsimd CONFIG REQUIRED)
if(xsimd_FOUND)
message(STATUS "XSIMD found")
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xsimd)
else(xsimd_FOUND)
message(FATAL_ERROR "Can't find XSIMD !")
endif(xsimd_FOUND)
#endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/xsimd")
find_package(xtl CONFIG REQUIRED)
if(xtl_FOUND)
message(STATUS "XTL found")
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xtl)
else(xtl_FOUND)
message(FATAL_ERROR "Can't find XTL !")
endif(xtl_FOUND)
find_package(xtensor CONFIG REQUIRED)
if(xtensor_FOUND)
if(xsimd_FOUND)
list(APPEND SCALFMM_COMPILE_DEFINITIONS XTENSOR_USE_XSIMD)
endif(xsimd_FOUND)
message(STATUS "XTENSOR found")
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xtensor)
else(xtensor_FOUND)
message(FATAL_ERROR "Can't find XTENSOR !")
endif(xtensor_FOUND)
#set(xtensor-blas_DIR $ENV{xtensor_blas_DIR})
#find_package(xtensor-blas CONFIG REQUIRED)
#if(xtensor-blas_FOUND)
# message(STATUS "XTENSOR-BLAS found")
# target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xtensor-blas)
#else(xtensor-blas_FOUND)
# message(FATAL_ERROR "Can't find XTENSOR-BLAS !")
#endif(xtensor-blas_FOUND)
# Find XSIMD properly
find_package(xsimd CONFIG REQUIRED)
if(xsimd_FOUND)
message(STATUS "XSIMD found")
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xsimd)
else(xsimd_FOUND)
message(FATAL_ERROR "Can't find XSIMD !")
endif(xsimd_FOUND)
find_package(xtl CONFIG REQUIRED)
if(xtl_FOUND)
message(STATUS "XTL found")
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xtl)
else(xtl_FOUND)
message(FATAL_ERROR "Can't find XTL !")
endif(xtl_FOUND)
find_package(xtensor CONFIG REQUIRED)
if(xtensor_FOUND)
if(xsimd_FOUND)
list(APPEND SCALFMM_COMPILE_DEFINITIONS XTENSOR_USE_XSIMD)
endif(xsimd_FOUND)
message(STATUS "XTENSOR found")
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xtensor)
else(xtensor_FOUND)
message(FATAL_ERROR "Can't find XTENSOR !")
endif(xtensor_FOUND)
#set(xtensor-blas_DIR $ENV{xtensor_blas_DIR})
#find_package(xtensor-blas CONFIG REQUIRED)
#if(xtensor-blas_FOUND)
# message(STATUS "XTENSOR-BLAS found")
# target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xtensor-blas)
#else(xtensor-blas_FOUND)
# message(FATAL_ERROR "Can't find XTENSOR-BLAS !")
#endif(xtensor-blas_FOUND)
#
# Module inria
......@@ -459,6 +453,7 @@ if(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/morse_cmake"
#
# Set ScalFMM compile definitions
# -------------------------------
set(SCALFMM_COMPILE_DEFINITIONS "${SCALFMM_COMPILE_DEFINITIONS}" CACHE STRING "Global compile definitions for ScalFMM")
message(STATUS "ScalFMM compile definitions : ${SCALFMM_COMPILE_DEFINITIONS}")
# And adding definitions to target
# --------------------------------
......
......@@ -27,8 +27,9 @@ foreach(exec ${source_tests_files})
add_executable( ${execname} ${exec})
list(APPEND SCALFMM_EXAMPLES_TARGETS ${execname})
list(APPEND SCALFMM_TESTS_TARGETS ${execname})
set_target_properties(${execname} PROPERTIES ENABLE_EXPORTS TRUE
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BUILD_TYPE}
set_target_properties(${execname}
PROPERTIES ENABLE_EXPORTS TRUE
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BUILD_TYPE}
)
target_compile_definitions(${execname} PUBLIC -DXTENSOR_USE_XSIMD)
target_link_libraries( ${execname} ${CMAKE_PROJECT_NAME})
......
//---------------------
// Experimental example
//---------------------
//#include <iosfwd>
//#include <string>
#include <algorithm>
#include <iostream>
#include <random>
......@@ -194,7 +192,5 @@ int main(int argc, char **argv) {
// std::for_each(cs.begin(), cs.end(), print_particle);
// component::tree t{};
return 0;
}
// --------------------------------
// See LICENCE file at project root
// File : particle_container.cpp
// File : concepts/library.hpp
// --------------------------------
#ifndef SCALFMM_CONCEPTS_LIBRARY_HPP
#define SCALFMM_CONCEPTS_LIBRARY_HPP
#include <type_traits>
namespace scalfmm::concepts
{
template<typename R, typename Enabler> struct require_impl;
template<typename R> struct require_impl<R, void> { using type = R; };
//template<typename R, typename Enabler>
//struct require_impl;
//template<typename R>
//struct require_impl<R, void>
//{
// using type = R;
//};
template<typename Return, typename... Ts>
struct require_check : require_impl<Return,std::void_t<Ts...>>
{};
//template<typename Return, typename... Ts>
//struct require_check : require_impl<Return, std::void_t<Ts...>>
//{
//};
template<typename From, typename To>
using Convertible = std::enable_if_t<std::is_convertible_v<From,To>>;
//template<typename From, typename To>
//using Convertible = std::enable_if_t<std::is_convertible_v<From, To>>;
template<typename T>
using Arithmetic = std::enable_if_t<std::is_arithmetic_v<T>>;
//template<typename T>
//using Arithmetic = std::enable_if_t<std::is_arithmetic_v<T>>;
template<typename T>
using Integral = std::enable_if_t<std::is_integral_v<T>>;
//template<typename T>
//using Integral = std::enable_if_t<std::is_integral_v<T>>;
template<bool Condition>
using If = std::enable_if_t<Condition>;
//template<bool Condition>
//using If = std::enable_if_t<Condition>;
} // end namespace scalfmm::concepts
} // end namespace scalfmm::concepts
//// Pseudo require macro
//#define requires(...)->typename ::concept ::require_check < __VA_ARGS__> ::type
// Pseudo require macro
#define requires(...) -> typename ::concept::require_check<__VA_ARGS__>::type
#endif // SCALFMM_CONCEPTS_LIBRARY_HPP
#endif // SCALFMM_CONCEPTS_LIBRARY_HPP
// --------------------------------
// See LICENCE file at project root
// File : particle_container.hpp
// File : container/particle_container.hpp
// --------------------------------
#ifndef SCALFMM_CONTAINER_PARTICLE_CONTAINER_HPP
#define SCALFMM_CONTAINER_PARTICLE_CONTAINER_HPP
......
......@@ -19,6 +19,8 @@
#include <inria/integer_sequence.hpp>
#include <xsimd/config/xsimd_align.hpp>
namespace scalfmm::container
{
/// To discard fold expression results
......@@ -1040,11 +1042,11 @@ namespace scalfmm::container
auto it = iterator{this->array_insert_range<Types, Indices>( // Magic happens here
std::get<Indices>(pos), std::get<Indices>(first), std::get<Indices>(last))...};
this->_size += count;
return it;
}
/** \brief Insert elements from a range
*
* \tparam ValueIterator Iterator type convertible to a tuple of elements
......
......@@ -58,7 +58,6 @@ namespace std
} // namespace std
/** \file */
/** \brief Multiple arrays allocator
*
* Allocates memory to create aligned arrays for types Ts that share one chunk
......
......@@ -7,6 +7,7 @@
#define SCALFMM_META_TRAITS_HPP
#include <scalfmm/meta/is_valid.hpp>
#include <xsimd/xsimd.hpp>
namespace scalfmm::meta
{
......
#ifndef SCALFMM_TOOLS_PROGRESS_BAR_HPP
#define SCALFMM_TOOLS_PROGRESS_BAR_HPP
#include <sstream>
#include <memory>
#include <thread>
#include <iostream>
#include <memory>
#include <scalfmm/tools/colorized.hpp>
#include <sstream>
#include <thread>
namespace scalfmm::tools
{
template<typename Object>
int progress(Object& obj);
template<typename Object>
int progress(Object& obj);
struct progress_bar {
std::stringstream sstr{};
std::thread t;
struct progress_bar
{
std::stringstream sstr{};
std::thread t;
template<typename Object>
void follow(Object& obj) {
this->t = std::thread(
[this, &obj]() {
template<typename Object>
void follow(Object& obj)
{
this->t = std::thread([this, &obj]() {
bool run = true;
while(run) {
while(run)
{
sstr.str("");
sstr.clear();
sstr.precision(4);
......@@ -30,20 +32,19 @@ namespace scalfmm::tools
sstr << "[";
for(int i = 0; i < 100; ++i)
{
sstr << (i < p ? "\u2038" : " ");
sstr << (i < p ? "\u2038" : " ");
}
sstr << "] " << p << "% ";
std::cout << '\r' << sstr.str() << std::flush;
run = p < 100;
run = p < 100;
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
});
}
}
void finish() { this->t.join(); }
};
} // namespace scalfmm::tools
void finish() {
this->t.join();
}
};
}
#endif
......@@ -87,3 +87,4 @@ namespace scalfmm::component
} // end namespace scalfmm::coomponents
#endif // SCALFMM_TREE_TREE_HPP
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