Commit 3a3e02c6 by Kirill Terekhov

Adaptation for K-means clustering, cmake option to link opencl

parent a41c6621
......@@ -16,6 +16,7 @@ option(USE_MPI_P2P "Use MPI point to point functionality, may be faster with har
option(USE_MPI_FILE "Use MPI extension to work with files, may save a lot of memory" ON)
option(USE_MPI2 "Use MPI-2 extensions, useful if your MPI library warns you to use new functions" ON)
option(USE_OMP "Compile with OpenMP support (experimental)" OFF)
option(USE_OPENCL "Use OpenCL where possible (experimental)" OFF)
option(USE_MESH "Compile mesh capabilities" ON)
option(USE_SOLVER "Compile solver capabilities" ON)
......@@ -33,7 +34,6 @@ option(USE_SOLVER_MONDRIAAN "Use Mondriaan for matrix reordering" OFF)
option(USE_SOLVER_PETSC "Use PETSc solvers" OFF)
option(USE_SOLVER_TRILINOS "Use Trilinos solvers" OFF)
option(USE_SOLVER_SUPERLU "Use SuperLU solver" OFF)
#option(USE_AUTODIFF_OPENCL "Use OpenCL for automatic differentiation (under work)" OFF)
#option(USE_AUTODIFF_ASMJIT "Use AsmJit for automatic differentiation" OFF)
#option(USE_AUTODIFF_EXPRESSION_TEMPLATES "Use c++ expression templates for automatic differentiation" OFF)
......@@ -206,13 +206,13 @@ if(USE_SOLVER_SUPERLU)
endif()
endif()
if(USE_AUTODIFF_OPENCL)
if(USE_OPENCL)
find_package(OpenCL)
if(OPENCL_FOUND)
include_directories(${OPENCL_INCLUDE_DIRS})
link_directories(${PETSC_LIBRARY_DIRS})
link_directories(${OpenCL_LIBRARY})
else()
set(USE_AUTODIFF_OPENCL OFF CACHE BOOL "Use OpenCL for automatic differentiation" FORCE)
set(USE_OPENCL OFF CACHE BOOL "Use OpenCL where possible (experimental)" FORCE)
message("OpenCL not found")
endif()
endif()
......
......@@ -90,7 +90,7 @@ int main(int argc,char ** argv)
{ // currently only non-distributed meshes are supported by Inner_RCM partitioner
ttt = Timer();
Partitioner * p = new Partitioner(m);
p->SetMethod(Partitioner::Inner_RCM,Partitioner::Partition); // Specify the partitioner
p->SetMethod(Partitioner::INNER_KMEANS,Partitioner::Partition); // Specify the partitioner
p->Evaluate(); // Compute the partitioner and store new processor ID in the mesh
delete p;
BARRIER;
......
......@@ -125,7 +125,7 @@ int main(int argc,char ** argv)
{ // Compute mesh partitioning
ttt = Timer();
Partitioner p(m); //Create Partitioning object
p.SetMethod(Partitioner::Inner_RCM,repartition ? Partitioner::Repartition : Partitioner::Partition); // Specify the partitioner
p.SetMethod(Partitioner::INNER_KMEANS,repartition ? Partitioner::Repartition : Partitioner::Partition); // Specify the partitioner
p.Evaluate(); // Compute the partitioner and store new processor ID in the mesh
BARRIER
if( m->GetProcessorRank() == 0 ) std::cout << "Evaluate: " << Timer()-ttt << std::endl;
......
......@@ -92,7 +92,7 @@ int main(int argc,char ** argv)
{ // currently only non-distributed meshes are supported by Inner_RCM partitioner
ttt = Timer();
Partitioner * p = new Partitioner(m);
p->SetMethod(Partitioner::Inner_RCM,Partitioner::Partition); // Specify the partitioner
p->SetMethod(Partitioner::INNER_KMEANS,Partitioner::Partition); // Specify the partitioner
p->Evaluate(); // Compute the partitioner and store new processor ID in the mesh
delete p;
BARRIER
......
......@@ -320,7 +320,7 @@ int main(int argc,char ** argv)
{
{ // Compute mesh partitioning
Partitioner p(&m); //Create Partitioning object
p.SetMethod(Partitioner::Inner_RCM,repartition ? Partitioner::Repartition : Partitioner::Partition); // Specify the partitioner
p.SetMethod(Partitioner::INNER_KMEANS,repartition ? Partitioner::Repartition : Partitioner::Partition); // Specify the partitioner
p.Evaluate(); // Compute the partitioner and store new processor ID in the mesh
}
......
......@@ -206,7 +206,7 @@ int main(int argc,char ** argv)
#if defined(USE_PARTITIONER)
ttt = Timer();
Partitioner * p = new Partitioner(m);
p->SetMethod(Partitioner::Inner_RCM,Partitioner::Partition);
p->SetMethod(Partitioner::INNER_KMEANS,Partitioner::Partition);
p->Evaluate();
delete p;
BARRIER
......@@ -523,4 +523,4 @@ int main(int argc,char ** argv)
Solver::Finalize();
Mesh::Finalize();
return 0;
}
\ No newline at end of file
}
......@@ -6,9 +6,7 @@
#include "asmjit.h"
#endif
#if defined(USE_AUTODIFF_OPENCL)
#include <CL/cl.h>
#endif
namespace INMOST
......
......@@ -7,6 +7,7 @@
#if !defined(INMOST_OPTIONS_CMAKE_INCLUDED)
//no options from cmake -- define minimum
//#define USE_OMP
//#define USE_OPENCL
#define USE_MESH
......@@ -28,7 +29,6 @@
#define USE_AUTODIFF
//#define USE_AUTODIFF_ASMJIT
//#define USE_AUTODIFF_OPENCL
//#define USE_AUTODIFF_EXPRESSION_TEMPLATES
//#define USE_MPI //include mpi for mpi functions
......@@ -88,6 +88,14 @@
#endif
#endif
#if defined(USE_OPENCL)
#ifdef __APPLE__
#include "OpenCL/opencl.h"
#else
#include "CL/cl.h"
#endif
#endif
#include <string>
#include <vector>
#include <set>
......
......@@ -2,12 +2,12 @@
#define INMOST_OPTIONS_CMAKE_INCLUDED
#cmakedefine USE_OMP
#cmakedefine USE_OPENCL
#cmakedefine USE_MESH
#cmakedefine USE_AUTODIFF
#cmakedefine USE_AUTODIFF_EXPRESSION_TEMPLATES
#cmakedefine USE_AUTODIFF_OPENCL
#cmakedefine USE_AUTODIFF_ASMJIT
#cmakedefine USE_PARTITIONER
......
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