Merge remote-tracking branch 'upstream/develop' into efischer/160311-StagedPackage

This commit is contained in:
citibeth 2016-03-25 17:14:35 -04:00
commit 358b387283
9 changed files with 132 additions and 106 deletions

View file

@ -0,0 +1,22 @@
# HG changeset patch
# User Sean Farley <sean@mcs.anl.gov>
# Date 1332269671 18000
# Tue Mar 20 13:54:31 2012 -0500
# Node ID b95c0c2e1d8bf8e3273f7d45e856f0c0127d998e
# Parent 88049269953c67c3fdcc4309bf901508a875f0dc
cmake: add gklib headers to install into include
diff -r 88049269953c -r b95c0c2e1d8b libmetis/CMakeLists.txt
Index: libmetis/CMakeLists.txt
===================================================================
--- a/libmetis/CMakeLists.txt Tue Mar 20 13:54:29 2012 -0500
+++ b/libmetis/CMakeLists.txt Tue Mar 20 13:54:31 2012 -0500
@@ -12,6 +12,8 @@ endif()
if(METIS_INSTALL)
install(TARGETS metis
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib
ARCHIVE DESTINATION lib)
+ install(FILES gklib_defs.h DESTINATION include)
+ install(FILES gklib_rename.h DESTINATION include)
endif()

View file

@ -24,7 +24,7 @@
############################################################################## ##############################################################################
from spack import * from spack import *
import glob
class Metis(Package): class Metis(Package):
""" """
@ -49,6 +49,8 @@ class Metis(Package):
depends_on('gdb', when='+gdb') depends_on('gdb', when='+gdb')
patch('install_gklib_defs_rename.patch')
def install(self, spec, prefix): def install(self, spec, prefix):
options = [] options = []
@ -81,3 +83,10 @@ def install(self, spec, prefix):
cmake(source_directory, *options) cmake(source_directory, *options)
make() make()
make("install") make("install")
# install GKlib headers, which will be needed for ParMETIS
GKlib_dist = join_path(prefix.include,'GKlib')
mkdirp(GKlib_dist)
fs = glob.glob(join_path(source_directory,'GKlib',"*.h"))
for f in fs:
install(f, GKlib_dist)

View file

@ -43,6 +43,13 @@ def install(self, spec, prefix):
"--enable-dap" "--enable-dap"
] ]
# Make sure Netcdf links against Spack's curl
# Otherwise it may pick up system's curl, which could lead to link errors:
# /usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
LIBS.append("-lcurl")
CPPFLAGS.append("-I%s" % spec['curl'].prefix.include)
LDFLAGS.append ("-L%s" % spec['curl'].prefix.lib)
if '+mpi' in spec: if '+mpi' in spec:
config_args.append('--enable-parallel4') config_args.append('--enable-parallel4')

View file

@ -1,46 +0,0 @@
from spack import *
import os
class NetlibBlas(Package):
"""Netlib reference BLAS"""
homepage = "http://www.netlib.org/lapack/"
url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz"
version('3.5.0', 'b1d3e3e425b2e44a06760ff173104bdf')
variant('fpic', default=False, description="Build with -fpic compiler option")
# virtual dependency
provides('blas')
# Doesn't always build correctly in parallel
parallel = False
def patch(self):
os.symlink('make.inc.example', 'make.inc')
mf = FileFilter('make.inc')
mf.filter('^FORTRAN.*', 'FORTRAN = f90')
mf.filter('^LOADER.*', 'LOADER = f90')
mf.filter('^CC =.*', 'CC = cc')
if '+fpic' in self.spec:
mf.filter('^OPTS.*=.*', 'OPTS = -O2 -frecursive -fpic')
mf.filter('^CFLAGS =.*', 'CFLAGS = -O3 -fpic')
def install(self, spec, prefix):
make('blaslib')
# Tests that blas builds correctly
make('blas_testing')
# No install provided
mkdirp(prefix.lib)
install('librefblas.a', prefix.lib)
# Blas virtual package should provide blas.a and libblas.a
with working_dir(prefix.lib):
symlink('librefblas.a', 'blas.a')
symlink('librefblas.a', 'libblas.a')

View file

@ -1,13 +1,12 @@
from spack import * from spack import *
class NetlibLapack(Package): class NetlibLapack(Package):
""" """
LAPACK version 3.X is a comprehensive FORTRAN library that does LAPACK version 3.X is a comprehensive FORTRAN library that does linear algebra operations including matrix
linear algebra operations including matrix inversions, least inversions, least squared solutions to linear sets of equations, eigenvector analysis, singular value
squared solutions to linear sets of equations, eigenvector decomposition, etc. It is a very comprehensive and reputable package that has found extensive use in the
analysis, singular value decomposition, etc. It is a very scientific community.
comprehensive and reputable package that has found extensive
use in the scientific community.
""" """
homepage = "http://www.netlib.org/lapack/" homepage = "http://www.netlib.org/lapack/"
url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz" url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz"
@ -19,41 +18,34 @@ class NetlibLapack(Package):
version('3.4.0', '02d5706ec03ba885fc246e5fa10d8c70') version('3.4.0', '02d5706ec03ba885fc246e5fa10d8c70')
version('3.3.1', 'd0d533ec9a5b74933c2a1e84eedc58b4') version('3.3.1', 'd0d533ec9a5b74933c2a1e84eedc58b4')
variant('shared', default=False, description="Build shared library version") variant('debug', default=False, description='Activates the Debug build type')
variant('fpic', default=False, description="Build with -fpic compiler option") variant('shared', default=True, description="Build shared library version")
variant('external-blas', default=False, description='Build lapack with an external blas')
variant('lapacke', default=True, description='Activates the build of the LAPACKE C interface')
# virtual dependency # virtual dependency
provides('blas', when='~external-blas')
provides('lapack') provides('lapack')
# blas is a virtual dependency.
depends_on('blas')
depends_on('cmake') depends_on('cmake')
depends_on('blas', when='+external-blas')
# Doesn't always build correctly in parallel
parallel = False
@when('^netlib-blas')
def get_blas_libs(self):
blas = self.spec['netlib-blas']
return [join_path(blas.prefix.lib, 'blas.a')]
@when('^atlas')
def get_blas_libs(self):
blas = self.spec['atlas']
return [join_path(blas.prefix.lib, l)
for l in ('libf77blas.a', 'libatlas.a')]
def install(self, spec, prefix): def install(self, spec, prefix):
blas_libs = ";".join(self.get_blas_libs()) cmake_args = ['-DBUILD_SHARED_LIBS:BOOL=%s' % ('ON' if '+shared' in spec else 'OFF'),
cmake_args = [".", '-DBLAS_LIBRARIES=' + blas_libs] '-DCMAKE_BUILD_TYPE:STRING=%s' % ('Debug' if '+debug' in spec else 'Release'),
'-DLAPACKE:BOOL=%s' % ('ON' if '+lapacke' in spec else 'OFF')]
if '+external-blas' in spec:
# TODO : the mechanism to specify the library should be more general,
# TODO : but this allows to have an hook to an external blas
cmake_args.extend([
'-DUSE_OPTIMIZED_BLAS:BOOL=ON',
'-DBLAS_LIBRARIES:PATH=%s' % join_path(spec['blas'].prefix.lib, 'libblas.a')
])
if '+shared' in spec: cmake_args.extend(std_cmake_args)
cmake_args.append('-DBUILD_SHARED_LIBS=ON')
if '+fpic' in spec:
cmake_args.append('-DCMAKE_POSITION_INDEPENDENT_CODE=ON')
cmake_args += std_cmake_args with working_dir('spack-build', create=True):
cmake('..', *cmake_args)
cmake(*cmake_args)
make() make()
make("install") make("install")

View file

@ -1,13 +1,71 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca945dd..1bf94e9 100644 index ca945dd..aff8b5f 100644
--- a/CMakeLists.txt --- a/CMakeLists.txt
+++ b/CMakeLists.txt +++ b/CMakeLists.txt
@@ -23,7 +23,7 @@ else()
set(ParMETIS_LIBRARY_TYPE STATIC)
endif()
-include(${GKLIB_PATH}/GKlibSystem.cmake)
+include_directories(${GKLIB_PATH})
# List of paths that the compiler will search for header files.
# i.e., the -I equivalent
@@ -33,7 +33,7 @@ include_directories(${GKLIB_PATH}) @@ -33,7 +33,7 @@ include_directories(${GKLIB_PATH})
include_directories(${METIS_PATH}/include) include_directories(${METIS_PATH}/include)
# List of directories that cmake will look for CMakeLists.txt # List of directories that cmake will look for CMakeLists.txt
-add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis) -add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis)
+#add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis) +find_library(METIS_LIBRARY metis PATHS ${METIS_PATH}/lib)
add_subdirectory(include) add_subdirectory(include)
add_subdirectory(libparmetis) add_subdirectory(libparmetis)
add_subdirectory(programs) add_subdirectory(programs)
diff --git a/libparmetis/CMakeLists.txt b/libparmetis/CMakeLists.txt
index 9cfc8a7..e0c4de7 100644
--- a/libparmetis/CMakeLists.txt
+++ b/libparmetis/CMakeLists.txt
@@ -5,7 +5,10 @@ file(GLOB parmetis_sources *.c)
# Create libparmetis
add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources})
# Link with metis and MPI libraries.
-target_link_libraries(parmetis metis ${MPI_LIBRARIES})
+target_link_libraries(parmetis ${METIS_LIBRARY} ${MPI_LIBRARIES})
+if(UNIX)
+ target_link_libraries(parmetis m)
+endif()
set_target_properties(parmetis PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
install(TARGETS parmetis
diff --git a/libparmetis/parmetislib.h b/libparmetis/parmetislib.h
index c1daeeb..07511f6 100644
--- a/libparmetis/parmetislib.h
+++ b/libparmetis/parmetislib.h
@@ -20,13 +20,12 @@
#include <parmetis.h>
-#include "../metis/libmetis/gklib_defs.h"
+#include <gklib_defs.h>
-#include <mpi.h>
+#include <mpi.h>
#include <rename.h>
#include <defs.h>
#include <struct.h>
#include <macros.h>
#include <proto.h>
-
diff --git a/programs/parmetisbin.h b/programs/parmetisbin.h
index e26cd2d..d156480 100644
--- a/programs/parmetisbin.h
+++ b/programs/parmetisbin.h
@@ -19,7 +19,7 @@
#include <GKlib.h>
#include <parmetis.h>
-#include "../metis/libmetis/gklib_defs.h"
+#include <gklib_defs.h>
#include "../libparmetis/rename.h"
#include "../libparmetis/defs.h"
#include "../libparmetis/struct.h"

View file

@ -1,14 +0,0 @@
diff --git a/libparmetis/CMakeLists.txt b/libparmetis/CMakeLists.txt
index 9cfc8a7..dfc0125 100644
--- a/libparmetis/CMakeLists.txt
+++ b/libparmetis/CMakeLists.txt
@@ -5,7 +5,7 @@ file(GLOB parmetis_sources *.c)
# Create libparmetis
add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources})
# Link with metis and MPI libraries.
-target_link_libraries(parmetis metis ${MPI_LIBRARIES})
+target_link_libraries(parmetis metis ${MPI_LIBRARIES} "-lm")
set_target_properties(parmetis PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
install(TARGETS parmetis

View file

@ -52,8 +52,6 @@ class Parmetis(Package):
# https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/ # https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/
patch('pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch') patch('pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch')
patch('link-to-lm.patch')
depends_on('gdb', when='+gdb') depends_on('gdb', when='+gdb')
def install(self, spec, prefix): def install(self, spec, prefix):
@ -66,7 +64,7 @@ def install(self, spec, prefix):
# FIXME : Once a contract is defined, MPI compilers should be retrieved indirectly via spec['mpi'] in case # FIXME : Once a contract is defined, MPI compilers should be retrieved indirectly via spec['mpi'] in case
# FIXME : they use a non-standard name # FIXME : they use a non-standard name
options.extend(['-DGKLIB_PATH:PATH={metis_source}/GKlib'.format(metis_source=metis_source), # still need headers from METIS source, and they are not installed with METIS. shame... options.extend(['-DGKLIB_PATH:PATH={metis_source}/GKlib'.format(metis_source=spec['metis'].prefix.include),
'-DMETIS_PATH:PATH={metis_source}'.format(metis_source=spec['metis'].prefix), '-DMETIS_PATH:PATH={metis_source}'.format(metis_source=spec['metis'].prefix),
'-DCMAKE_C_COMPILER:STRING=mpicc', '-DCMAKE_C_COMPILER:STRING=mpicc',
'-DCMAKE_CXX_COMPILER:STRING=mpicxx']) '-DCMAKE_CXX_COMPILER:STRING=mpicxx'])