Commit 5f1ee259 authored by David Moxey's avatar David Moxey

Start fixing cases where Scotch isn't enabled

parent 674165af
......@@ -56,8 +56,6 @@ ENABLE_TESTING()
# Use the CMake 2.4 policy for CMake 2.6
IF(COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0003 OLD)
# Silence warnings when using generator expressions in
# TARGET_LINK_LIBRARIES.
IF(POLICY CMP0022)
......
......@@ -59,6 +59,7 @@ IF( NEKTAR_USE_MPI )
BINARY_DIR ${TPBUILD}/gsmpi-1.2.1
TMP_DIR ${TPBUILD}/gsmpi-1.2.1-tmp
INSTALL_DIR ${TPDIST}
BUILD_BYPRODUCTS ${TPDIST}/lib/libgsmpi.a ${TPDIST}/lib/libxxt.a
CONFIGURE_COMMAND
${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
......
......@@ -64,5 +64,9 @@ IF (NEKTAR_USE_METIS)
SET(METIS_CONFIG_INCLUDE_DIR ${TPINC})
INCLUDE_DIRECTORIES(${TPDIST}/include)
ELSE (THIRDPARTY_BUILD_SCOTCH)
ADD_CUSTOM_TARGET(metis-5.1.0 ALL)
MESSAGE(STATUS "Found Metis: ${METIS_LIBRARY}")
SET(METIS_CONFIG_INCLUDE_DIR ${METIS_INCLUDE_DIR})
ENDIF()
ENDIF()
\ No newline at end of file
......@@ -27,6 +27,8 @@ IF (NEKTAR_USE_SCOTCH)
"Build Scotch library from ThirdParty" ${BUILD_SCOTCH}
"NEKTAR_USE_SCOTCH" OFF)
ADD_DEFINITIONS(-DNEKTAR_USE_SCOTCH)
IF (THIRDPARTY_BUILD_SCOTCH)
UNSET(FLEX CACHE)
FIND_PROGRAM(FLEX flex)
......
......@@ -40,11 +40,9 @@ ADD_NEKTAR_TEST(Helmholtz1D_HDG_P8_RBC)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Nodes)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_mlsc)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_sc)
#ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_full)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_iter_sc)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_iter_ml)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P9_Modes_varcoeff)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_curved_quad)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_curved_tri)
......@@ -58,11 +56,9 @@ ADD_NEKTAR_TEST(Helmholtz2D_CG_varP_Modes)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Hex LENGTHY)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Hex_Heterogeneous)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Hex_AllBCs)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Hex_AllBCs_iter_ml)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Hex_AllBCs_iter_sc_cont)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Tet)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Prism)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Prism_iter_ml)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Prism_Deformed)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Pyr)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Pyr_Deformed)
......@@ -76,6 +72,15 @@ ADD_NEKTAR_TEST(LinearAdvDiffReact2D_P7_Modes)
ADD_NEKTAR_TEST(Deriv3D_Homo1D)
ADD_NEKTAR_TEST(Deriv3D_Homo2D)
# Tests exclusively for multi-level static condensation (which will not run
# using Windows).
IF (NEKTAR_USE_SCOTCH)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_mlsc)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_iter_ml)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Prism_iter_ml)
ADD_NEKTAR_TEST(Helmholtz3D_CG_Hex_AllBCs_iter_ml)
ENDIF()
# PETSc solver tests
IF (NEKTAR_USE_PETSC)
ADD_NEKTAR_TEST(Helmholtz2D_CG_P7_Modes_AllBCs_petsc_full)
......
......@@ -85,9 +85,15 @@ namespace Nektar
MultiRegions::ePETScMultiLevelStaticCond)
};
#ifdef NEKTAR_USE_SCOTCH
std::string GlobalLinSys::def = LibUtilities::SessionReader::
RegisterDefaultSolverInfo("GlobalSysSoln",
"DirectMultiLevelStaticCond");
#else
std::string GlobalLinSys::def = LibUtilities::SessionReader::
RegisterDefaultSolverInfo("GlobalSysSoln",
"DirectStaticCond");
#endif
/**
* @class GlobalLinSys
......
......@@ -47,18 +47,20 @@
#include <boost/graph/bandwidth.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <scotch.h>
using std::max;
using std::cout;
using std::endl;
#ifdef NEKTAR_USE_SCOTCH
#include <scotch.h>
#define SCOTCH_CALL(scotchFunc, args) \
{ \
ASSERTL0(scotchFunc args == 0, \
std::string("Error in Scotch calling function ") \
+ std::string(#scotchFunc)); \
}
#endif
namespace Nektar
{
......@@ -776,6 +778,10 @@ namespace Nektar
std::set<int> partVerts,
int mdswitch)
{
#ifndef NEKTAR_USE_SCOTCH
ASSERTL0(false, "Multi-level static condensation requires Nektar++"
" to be built with SCOTCH.");
#else
int nGraphVerts = boost::num_vertices(graph);
int nGraphEdges = boost::num_edges (graph);
......@@ -874,14 +880,14 @@ namespace Nektar
// reordering strategy, which essentially does a nested
// dissection + compression. We take this almost directly from
// the SCOTCH_stratGraphOrderBuild function (defined in
// library_graph_order.c), but in this version we can replace
// the subdivision strategy to allow us to control the number of
// vertices used to determine whether to perform another
// dissection using the mdswitch parameter. The below is
// essentially equivalent to calling SCOTCH_stratGraphOrderBuild
// with the flags SCOTCH_STRATLEAFSIMPLE and
// SCOTCH_STRATSEPASIMPLE to make sure leaf nodes do not have
// any reordering applied to them.
// library_graph_order.c), but by specifying the string
// manually, we can replace the subdivision strategy to allow us
// to control the number of vertices used to determine whether
// to perform another dissection using the mdswitch
// parameter. The below is essentially equivalent to calling
// SCOTCH_stratGraphOrderBuild with the flags
// SCOTCH_STRATLEAFSIMPLE and SCOTCH_STRATSEPASIMPLE to make
// sure leaf nodes do not have any reordering applied to them.
std::string strat_str =
"c{rat=0.7,cpr=n{sep=/(<TSTS>)?m{rat=0.7,vert=100,low="
"h{pass=10},asc=b{width=3,bnd=f{bal=<BBAL>},"
......@@ -912,9 +918,9 @@ namespace Nektar
// (i.e. the separators and all of the leaves), the separator
// tree as a mapping of block to parent block, and the range of
// indices that is contained within each block. Reordering of
// the vertices goes from highest (at the top level) to smallest
// (at the bottom level). The precise ordering is given in the
// Scotch user guide.
// the vertices goes from largest index (at the top level) to
// smallest (at the bottom level). The precise ordering is given
// in the Scotch user guide.
//
// Note that we pass in iperm into the 'permtab' field of
// graphOrder and 'perm' into the 'peritab' field; this is
......@@ -949,8 +955,7 @@ namespace Nektar
{
// Set up this block.
graphs[i] = MemoryManager<MultiLevelBisectedGraph>
::AllocateSharedPtr(
rangtab[i+1] - rangtab[i]);
::AllocateSharedPtr(rangtab[i+1] - rangtab[i]);
// If we're the root block (treetab[i] == -1) we don't need
// to do anything, go onto the next block.
......@@ -965,7 +970,9 @@ namespace Nektar
// _first_ in the iperm/perm arrays returned from Scotch,
// but if there is both a left and right daughter, we'll
// come across the right daughter first because the
// separators are being traversed backwards.
// separators are being traversed backwards. In this case we
// therefore need to set the left daughter graph to be the
// right daughter and re-set the left daughter.
MultiLevelBisectedGraphSharedPtr tmp = graphs[treetab[i]];
int nDaughter = tmp->GetNdaughterGraphs();
......@@ -996,8 +1003,7 @@ namespace Nektar
}
}
auto it = partVerts.begin();
auto it2 = partVerts.end();
auto it = partVerts.begin(), it2 = partVerts.end();
for (i = nNonPartition; it != it2; ++it, ++i)
{
perm [i] = *it;
......@@ -1010,6 +1016,9 @@ namespace Nektar
+ boost::lexical_cast<std::string>(i));
}
// Check that our degree of freedom count in the constructed
// graph is the same as the number of degrees of freedom that we
// were given in the function input.
ASSERTL0(graphs.back()->GetTotDofs() == nNonPartition,
"Error in constructing Scotch graph for multi-level"
" static condensation.");
......@@ -1049,6 +1058,7 @@ namespace Nektar
substructgraph = MemoryManager<BottomUpSubStructuredGraph>::
AllocateSharedPtr(nGraphVerts);
}
#endif
}
void NoReordering(const BoostGraph& graph,
......
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