Commit 0443814e authored by incardon's avatar incardon
Browse files

Merging with master

parents 0357b11b 93cb27f8
Pipeline #2043 failed with stages
in 10 minutes and 39 seconds
centos_build:
stage: build
tags:
- centos
artifacts:
paths:
- ./openfpm_io/build/src/io
- ./openfpm_io/test_data
script:
- ./build.sh $CI_PROJECT_DIR $CI_RUNNER_TAGS NO $CI_COMMIT_REF_NAME
centos_run:
stage: test
tags:
- centos
dependencies:
- centos_build
script:
- ./run.sh $CI_PROJECT_DIR $CI_RUNNER_TAGS NO $CI_COMMIT_REF_NAME
mac_build:
stage: build
tags:
- mac
artifacts:
paths:
- ./openfpm_io/build/src/io
- ./openfpm_io/test_data
script:
- ./build.sh $CI_PROJECT_DIR $CI_RUNNER_TAGS NO $CI_COMMIT_REF_NAME
mac_run:
stage: test
tags:
- mac
dependencies:
- mac_build
script:
- ./run.sh $CI_PROJECT_DIR $CI_RUNNER_TAGS NO $CI_COMMIT_REF_NAME
ubuntu_build:
stage: build
tags:
- ubuntu
artifacts:
paths:
- ./openfpm_io/build/src/io
- ./openfpm_io/test_data
script:
- ./build.sh $CI_PROJECT_DIR $CI_RUNNER_EXECUTABLE_TAGS NO $CI_COMMIT_REF_NAME
ubuntu_run:
stage: test
tags:
- ubuntu
dependencies:
- ubuntu_build
script:
- ./run.sh $CI_PROJECT_DIR $CI_RUNNER_TAGS NO $CI_COMMIT_REF_NAME
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(openfpm_pdata LANGUAGES C CXX)
if (POLICY CMP0074)
cmake_policy(SET CMP0074 OLD)
endif ()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake_modules/)
......@@ -38,11 +41,10 @@ if(ENABLE_GPU)
set(WARNING_SUPPRESSION_AND_OPTION_NVCC -Xcudafe "--display_error_number --diag_suppress=611 --diag_suppress=2885 --diag_suppress=2886 --diag_suppress=2887 --diag_suppress=2888 --diag_suppress=186 --diag_suppress=111 " --expt-extended-lambda)
elseif ( CUDA_VERSION_MAJOR EQUAL 10 AND CUDA_VERSION_MINOR EQUAL 1 )
message("CUDA is compatible")
set(WARNING_SUPPRESSION_AND_OPTION_NVCC -Xcudafe "--display_error_number --diag_suppress=2915 --diag_suppress=2912 --diag_suppress=2913 --diag_suppress=111 --diag_suppress=186 --diag_suppress=611 --diag_suppress=2928 --diag_suppress=2931 --diag_suppress=2929 --diag_suppress=2930" --expt-extended-lambda)
set(WARNING_SUPPRESSION_AND_OPTION_NVCC -Xcudafe "--display_error_number --diag_suppress=2915 --diag_suppress=2912 --diag_suppress=2913 --diag_suppress=111 --diag_suppress=186 --diag_suppress=611 " --expt-extended-lambda)
elseif ( CUDA_VERSION_MAJOR EQUAL 10 AND CUDA_VERSION_MINOR EQUAL 2 )
message("CUDA is compatible")
set(WARNING_SUPPRESSION_AND_OPTION_NVCC -Xcudafe "--display_error_number --diag_suppress=2976 --diag_suppress=2977 --diag_suppress=2978 --diag_suppress=2979 --diag_suppress=1835 --diag_suppress=611 --diag_suppress=186 --diag_suppress=128" --expt-extended-lambda)
set(WARNING_SUPPRESSION_AND_OPTION_NVCC_TEXT "-Xcudafe \"--display_error_number --diag_suppress=2976 --diag_suppress=2977 --diag_suppress=2978 --diag_suppress=2979 --diag_suppress=1835 --diag_suppress=611 --diag_suppress=186 --diag_suppress=128\" --expt-extended-lambda")
set(WARNING_SUPPRESSION_AND_OPTION_NVCC -Xcudafe "--display_error_number --diag_suppress=2977 --diag_suppress=2976 --diag_suppress=2979 --diag_suppress=186" --expt-extended-lambda)
else()
message(FATAL_ERROR "CUDA is incompatible, version 9.2 10.1 and 10.2 is only supported")
endif()
......
......@@ -19,13 +19,19 @@ mv /tmp/openfpm_io openfpm_io
git clone git@git.mpi-cbg.de:openfpm/openfpm_devices.git openfpm_devices
cd openfpm_devices
git checkout sparse_cl
cd ..
git clone git@git.mpi-cbg.de:openfpm/openfpm_data.git openfpm_data
cd openfpm_data
git checkout sparse_cl_broken
cd ..
git clone git@git.mpi-cbg.de:openfpm/openfpm_pdata.git openfpm_pdata
cd openfpm_pdata
git checkout sparse_cl
cd ..
git clone git@git.mpi-cbg.de:openfpm/openfpm_vcluster.git openfpm_vcluster
cd openfpm_vcluster
git checkout sparse_cl
cd ..
cd "$1/openfpm_io"
......
......@@ -5,15 +5,11 @@ branch=$3
# Make a directory in /tmp/openfpm_data
cd "$1/openfpm_io"
if [ "$2" == "gin" ]
then
module load gcc/4.9.2
module load boost/1.54.0
fi
cd "openfpm_io"
echo "CHECKING MACHINE"
if [ x"$hostname" == x"cifarm-centos-node.mpi-cbg.de" ]; then
echo "CENTOS"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/openfpm_dependencies/openfpm_io/$branch/HDF5/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/openfpm_dependencies/openfpm_io/$branch/BOOST/lib"
fi
......@@ -24,14 +20,13 @@ if [ x"$hostname" == x"cifarm-ubuntu-node" ]; then
fi
if [ x"$hostname" == x"cifarm-mac-node.mpi-cbg.de" ]; then
echo "MACOS X"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$HOME/openfpm_dependencies/openfpm_io/$branch/HDF5/lib"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$HOME/openfpm_dependencies/openfpm_io/$branch/BOOST/lib"
fi
pwd
./build/src/io
if [ $? -ne 0 ]; then
curl -X POST --data "payload={\"icon_emoji\": \":jenkins:\", \"username\": \"jenkins\" , \"attachments\":[{ \"title\":\"Error:\", \"color\": \"#FF0000\", \"text\":\"$2 failed to complete the openfpm_io test \" }] }" https://hooks.slack.com/services/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
exit 1 ;
fi
......@@ -24,6 +24,11 @@ endif()
if (CUDA_FOUND)
target_compile_options(io PUBLIC $<$<COMPILE_LANGUAGE:CUDA>: ${WARNING_SUPPRESSION_AND_OPTION_NVCC} >)
target_include_directories (io PUBLIC ${MPI_C_INCLUDE_DIRS})
if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 )
add_compile_options( "-fabi-version=6" )
endif()
if (TEST_COVERAGE)
target_compile_options(io PRIVATE $<$<COMPILE_LANGUAGE:CUDA>: -Xcompiler "-fprofile-arcs -ftest-coverage" >)
endif()
......
......@@ -56,12 +56,12 @@ struct csv_prp
template<typename T>
void operator()(T& t)
{
// This is the type of the csv column
typedef decltype(obj.template get<T::value>()) col_type;
// This is the type of the csv column
typedef typename boost::mpl::at<typename Tobj::type,T>::type col_type;
// Remove the reference from the column type
typedef typename boost::remove_reference<col_type>::type col_rtype;
typedef typename std::remove_all_extents<col_rtype>::type base_col_rtype;
// Remove the reference from the column type
typedef typename boost::remove_reference<col_type>::type col_rtype;
typedef typename std::remove_all_extents<col_rtype>::type base_col_rtype;
csv_value_str<col_rtype, is_csv_writable<base_col_rtype>::value >(obj.template get<T::value>(),str);
}
......
......@@ -125,17 +125,17 @@ struct vertex_prop
{cnt++; return ;}
// Create a property string based on the type of the property
if (typeid(T) == typeid(float))
if (std::is_same<T,float>::value)
v_prop += "<key id=\"vk" + std::to_string(cnt) + "\" for=\"node\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"float\"/>\n";
else if (typeid(T) == typeid(double))
else if (std::is_same<T,double>::value)
v_prop += "<key id=\"vk" + std::to_string(cnt) + "\" for=\"node\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"double\"/>\n";
else if (typeid(T) == typeid(int))
else if (std::is_same<T,int>::value)
v_prop += "<key id=\"vk" + std::to_string(cnt) + "\" for=\"node\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"int\"/>\n";
else if (typeid(T) == typeid(long int))
else if (std::is_same<T,long int>::value)
v_prop += "<key id=\"vk" + std::to_string(cnt) + "\" for=\"node\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"long\"/>\n";
else if (typeid(T) == typeid(bool))
else if (std::is_same<T,bool>::value)
v_prop += "<key id=\"vk" + std::to_string(cnt) + "\" for=\"node\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"boolean\"/>\n";
else if (typeid(T) == typeid(std::string))
else if (std::is_same<T,std::string>::value)
v_prop += "<key id=\"vk" + std::to_string(cnt) + "\" for=\"node\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"string\"/>\n";
}
......@@ -278,18 +278,20 @@ struct vertex_node
//! Create an entry for the attribute
if (T::value < n_attr)
{
typedef typename std::remove_reference<decltype(vo.template get<T::value>())>::type type_get;
// Create a property string based on the type of the property
if (typeid(decltype(vo.template get<T::value>())) == typeid(float))
if (std::is_same<type_get,float>::value)
v_node += " <data key=\"vk" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(double))
else if (std::is_same<type_get,double>::value)
v_node += " <data key=\"vk" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(int))
else if (std::is_same<type_get,int>::value )
v_node += " <data key=\"vk" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(long int))
else if (std::is_same<type_get,long int>::value)
v_node += " <data key=\"vk" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(bool))
else if (std::is_same<type_get,bool>::value)
v_node += " <data key=\"vk" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(std::string))
else if (std::is_same<type_get,std::string>::value)
v_node += " <data key=\"vk" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
}
......@@ -379,17 +381,17 @@ struct edge_prop
if (cnt < n_attr)
{
// Create a property string based on the type of the property
if (typeid(T) == typeid(float))
if (std::is_same<T,float>::value)
e_prop += "<key id=\"ek" + std::to_string(cnt) + "\" for=\"edge\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"float\"/>\n";
else if (typeid(T) == typeid(double))
else if (std::is_same<T,double>::value)
e_prop += "<key id=\"ek" + std::to_string(cnt) + "\" for=\"edge\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"double\"/>\n";
else if (typeid(T) == typeid(int))
else if (std::is_same<T,int>::value)
e_prop += "<key id=\"ek" + std::to_string(cnt) + "\" for=\"edge\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"int\"/>\n";
else if (typeid(T) == typeid(long int))
else if (std::is_same<T,long int>::value)
e_prop += "<key id=\"ek" + std::to_string(cnt) + "\" for=\"edge\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"long\"/>\n";
else if (typeid(T) == typeid(bool))
else if (std::is_same<T,bool>::value)
e_prop += "<key id=\"ek" + std::to_string(cnt) + "\" for=\"edge\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"boolean\"/>\n";
else if (typeid(T) == typeid(std::string))
else if (std::is_same<T,std::string>::value)
e_prop += "<key id=\"ek" + std::to_string(cnt) + "\" for=\"edge\" attr.name=\"" + attributes_names[cnt] + "\" attr.type=\"string\"/>\n";
}
......@@ -510,18 +512,20 @@ struct edge_node
//! Create an entry for the attribute
if (T::value < n_attr)
{
typedef typename std::remove_reference<decltype(vo.template get<T::value>())>::type type_get;
// Create a property string based on the type of the property
if (typeid(decltype(vo.template get<T::value>())) == typeid(float))
if (std::is_same<type_get,float>::value)
e_node += " <data key=\"ek" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(double))
else if (std::is_same<type_get,double>::value)
e_node += " <data key=\"ek" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(int))
else if (std::is_same<type_get,int>::value)
e_node += " <data key=\"ek" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(long int))
else if (std::is_same<type_get,long int>::value)
e_node += " <data key=\"ek" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(bool))
else if (std::is_same<type_get,bool>::value)
e_node += " <data key=\"ek" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
else if (typeid(decltype(vo.template get<T::value>())) == typeid(std::string))
else if (std::is_same<type_get,std::string>::value)
e_node += " <data key=\"ek" + std::to_string(cnt) + "\">" + std::to_string(vo.template get<T::value>()) + "</data>\n";
}
......
......@@ -10,7 +10,7 @@
#include "VCluster/VCluster.hpp"
#include <hdf5.h>
#include "hdf5.h"
template <unsigned int type>
class HDF5_writer
......
......@@ -10,6 +10,7 @@
#include <fstream>
#include "Vector/map_vector.hpp"
#include <cmath>
#define GGRAPH_COLUMS 1
#define GGRAPH_POINTS 2
......@@ -153,6 +154,33 @@ const std::string saving_javascript = "function save(i)\n\
var e = document.getElementById('chart_')\n\
e.getElementsByTagName('svg')[0].parentNode.innerHTML";
template<typename T>
struct check_nan
{
static bool check(const T & n)
{
return false;
}
};
template<>
struct check_nan<float>
{
static bool check(const float & n)
{
return std::isnan(n);
}
};
template<>
struct check_nan<double>
{
static bool check(const double & n)
{
return std::isnan(n);
}
};
/////////////////////////////////////////////////////////////////////
/*! \brief Small class to produce graph with Google chart in HTML
......@@ -186,12 +214,213 @@ const std::string saving_javascript = "function save(i)\n\
*/
class GoogleChart
{
template<typename arg_0, typename ... args>
struct get_value_type
{
typedef typename arg_0::value_type type;
};
//! set of graphs
openfpm::vector<GGraph> set_of_graphs;
//! set inject HTML;
openfpm::vector<std::string> injectHTML;
//! Data has holes
bool holes = false;
/*! \brief Recursively sort variadic template of vectors
*
* \param x vector with x
* \param y vector with y
* \param xy all the other vectors
*
*/
template<typename X, typename ... Xs>
void recursive_sort(X & x,X & y,Xs& ... xy)
{
struct srt_xy
{
typename X::value_type x;
unsigned int id;
bool operator<(const srt_xy & tmp) const
{
return x < tmp.x;
}
};
openfpm::vector<srt_xy> reord;
X y_tmp;
reord.resize(x.size());
y_tmp.resize(x.size());
for (size_t i = 0 ; i < x.size() ; i++)
{
reord.get(i).x = x.get(i);
reord.get(i).id = i;
}
reord.sort();
// reorder x and y
for (size_t i = 0 ; i < x.size() ; i++)
{
x.get(i) = reord.get(i).x;
y_tmp.get(i) = y.get(reord.get(i).id);
}
y_tmp.swap(y);
// sort x
recursive_sort(xy ...);
}
//! terminator for recursive sort
void recursive_sort()
{}
/*! \brief Recursively sort variadic template of vectors
*
* \param counters indexes
* \param x vector with x
* \param y vector with y
* \param xy all the other vectors
*
*/
template<typename X, typename ... Xs>
bool isNext(size_t * counters,X & x,X & y,Xs& ... xy)
{
if (counters[0] < x.size())
{
return true;
}
return isNext(&counters[1],xy ...);
}
/*! \brief Recursively sort variadic template of vectors
*
* \param counters indexes
*
*/
bool isNext(size_t * counters)
{
return false;
}
/*! \brief Recursively sort variadic template of vectors
*
* \param counters indexes
* \param x vector with x
* \param y vector with y
* \param xy all the other vectors
*
*/
template<typename T, typename X, typename ... Xs>
T get_low(size_t * counters,X & x,X & y,Xs& ... xy)
{
if (sizeof...(Xs) != 0)
{
T low1;
if (counters[0] >= x.size())
{low1 = std::numeric_limits<typename X::value_type>::infinity();}
else
{low1 = x.get(counters[0]);}
T low2 = get_low<T>(&counters[1],xy ...);
return (low1 < low2)?low1:low2;
}
if (counters[0] >= x.size())
{return std::numeric_limits<typename X::value_type>::infinity();}
return x.get(counters[0]);
}
/*! \brief Recursively sort variadic template of vectors
*
* \param counters indexes
*
*/
template<typename T>
T get_low(size_t * counters)
{
return 0.0;
}
/*! \brief Recursively sort variadic template of vectors
*
* \param x vector with x
* \param y vector with y
* \param xy all the other vectors
*
*/
template<typename X, typename ... Xs>
void get_point(typename X::value_type low,
typename X::value_type * point,
size_t * counters,
X & x,
X & y,
Xs& ... xy)
{
if (low == x.get(counters[0]))
{
point[0] = y.get(counters[0]);
counters[0]++;
}
else
{
point[0] = std::numeric_limits<typename X::value_type>::quiet_NaN();
}
get_point(low,&point[1],&counters[1],xy...);
}
/*! \brief Recursively sort variadic template of vectors
*
* \param x vector with x
* \param y vector with y
* \param xy all the other vectors
*
*/
template<typename T>
void get_point(T low,
T * point,
size_t * counters)
{
return;
}
/*! \brief Recursively sort variadic template of vectors
*
* \param x vector with x
* \param y vector with y
* \param xy all the other vectors
*
*/
template<typename ... Xs>
bool get_v(typename get_value_type<Xs...>::type & x,
typename get_value_type<Xs...>::type * point,
size_t * counters,
Xs& ... xy)
{
// if exist the next element
if (isNext(counters,xy...) == false)
{return false;}
// get lowest x
typename get_value_type<Xs...>::type low = get_low<typename get_value_type<Xs...>::type>(counters,xy...);
x = low;
get_point(low,point,counters,xy...);
return true;
}
/*! \brief Given X and Y vector return the string representing the data section of the Google Chart
*
* \tparam X type for the X coordinates
......@@ -215,7 +444,7 @@ class GoogleChart
// we require that the number of x elements are the same as y elements
if (x.size() != y.size())
std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " vector x and the vector y must have the same number of elements " << x.size() << "!=" << y.size() << "\n";
{std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " vector x and the vector y must have the same number of elements " << x.size() << "!=" << y.size() << "\n";}
// Google chart visualization
data << "var data" << i << " = new google.visualization.DataTable();\n";
......@@ -250,7 +479,17 @@ class GoogleChart
data << "[" << x.get(i);
}
else
data << "," << y.get(i).get(j-1);
{
if (check_nan<typename Y::value_type>::check(y.get(i).get(j-1)) == false)
{
data << "," << y.get(i).get(j-1);
}
else
{
holes = true;
data << "," << "null";
}
}
}
data << "],\n";
}
......@@ -351,6 +590,8 @@ class GoogleChart
of << "var options";
of << i;
of << "= {\n";
if (holes == true)
{of << "interpolateNulls : true,\n";}
of << opt;
of << "};\n";
}
......@@ -513,16 +754,69 @@ public:
set_of_graphs.last().opt = opt;
}
/*! \brief Add lines graph
*
* \param y A vector of vectors of values. each vector is a graph of points
* \param xy list of vectors like openfpm::vector<float> or openfpm::vector<double>. Suppose you have a dataset of points x1,y1