Commit 1e689e3c authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

external libraries mtl4 and muparser added to lib directory

parent 92e102a5
project (mtl4) # GPU version
cmake_minimum_required(VERSION 2.8)
option(ENABLE_GCOV "enable gnu coverage flags for gnu compiler" OFF)
option(ENABLE_WARNINGS "Enable gnu specific warnings" ON)
option(ENABLE_DEVELOPMENT "enable program parts under development" OFF)
# adding the Path of our own Modules
SET(CMAKE_MODULE_PATH $ENV{CMAKE_MODULE_PATH})
SET(MTL4_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
#SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MTL4_ROOT_PATH}/Cmake_Module)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MTL4_ROOT_PATH})
#look for mtl4, use THIS directory as mtl dir
find_package(MTL REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${MTL_INCLUDE_DIRS})
add_definitions(${MTL_CXX_DEFINITIONS})
#REMAINING PART USES MTL4
include(CheckCXXCompilerFlag)
#let cmake look for the svn-version, only needed for packages?
if (NOT MSVC)
find_package(Subversion)
if(Subversion_FOUND)
Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} mtlSubinfo)
set(CurrentRevision ${mtlSubinfo_WC_REVISION})
# message("current revision: ${mtlSubinfo_WC_REVISION}")
else(Subversion_FOUND)
set(CurrentRevision "0")
endif(Subversion_FOUND)
endif (NOT MSVC)
# if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
# endif()
configure_file(boost/numeric/mtl/version.hpp.in boost/numeric/mtl/version.hpp @ONLY)
#look for compiler specific settings
if (MSVC)
# to quiet DevStudio 2005 secure code warnings
add_definitions(/D_SCL_SECURE_NO_WARNINGS)
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
add_definitions(/DMTL_ASSERT_FOR_THROW /D_CRT_SECURE_NO_DEPRECATE /DNOMINMAX /D_CONSOLE /D"_HAS_ITERATOR_DEBUGGING=0" /D"_SECURE_SCL=0" )
# specialty flags such as the C++ language exception model etc. come from the init flags determined by CMAKE
# you may override them, but I have not found it necessary
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT} /wd4018 /wd4099 /wd4522 /wd4996 /wd4355 /wd4244 /Z7")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT} /wd4018 /wd4099 /wd4522 /wd4996 /wd4355 /wd4244 /Z7")
endif (MSVC)
if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND ENABLE_WARNINGS)
add_definitions("-Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings")
foreach(FLAG "-Wno-long-long") # "-Wno-unused-local-typedefs")
# message(STATUS "Check flag ${FLAG}")
mtl_check_cxx_compiler_flag(${FLAG} FLAG_OKAY)
if(FLAG_OKAY)
message(STATUS "Add ${FLAG}")
add_definitions("${FLAG}")
endif()
endforeach()
endif()
if (ENABLE_DEVELOPMENT)
add_definitions("-DMTL_WITH_DEVELOPMENT")
endif()
if (ENABLE_SHORT_ELE_PROD)
add_definitions("-DMTL_WITH_SHORT_ELE_PROD")
endif()
set(BUILDNAME "${TESTBUILDNAME}")
enable_testing()
include(CTest)
set(MTL_IS_CONFIGURED True) # impede double double configuration in libs
add_subdirectory(libs)
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "mtl4")
set(CTEST_NIGHTLY_START_TIME "00:00:00 CEST")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "simunova.zih.tu-dresden.de")
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=mtl4")
set(CTEST_DROP_SITE_CDASH TRUE)
# set(CTEST_CURL_OPTIONS "CURLOPT_SSL_VERIFYPEER_OFF")
# build in parallel if not on Windows
# if (NOT MSVC)
# message("now with make -j4")
# set(CTEST_BUILD_FLAGS -j4)
# endif()
while (${CTEST_ELAPSED_TIME} LESS 36)
set (START_TIME ${CTEST_ELAPSED_TIME})
ctest_start (Continuous)
ctest_sleep( ${START_TIME} 3 ${CTEST_ELAPSED_TIME})
endwhile()
This diff is collapsed.
-*- text -*-
Software License for MTL
Copyright (c) 2007-2008 The Trustees of Indiana University.
2008 Dresden University of Technology and the Trustees of Indiana University.
2010 SimuNova UG, www.simunova.com.
All rights reserved.
Authors: Peter Gottschling and Andrew Lumsdaine
This file is part of the Matrix Template Library
See also tools/license/license.mtl.txt in the distribution.
---------------------------------------------------------------
The Matrix Template Library
Version 4
I. Installation
===============
see http://www.simunova.com/node/189
set(MTL_COMMON_CONFIG "${MTL_DIR}/tools/cmake/MTLCommon.cmake")
if( EXISTS ${MTL_COMMON_CONFIG})
include(${MTL_COMMON_CONFIG})
else()
message(ERROR "could not find the common mtl configuration. this is possibly a wrong installation of mtl.")
endif()
-*- text -*-
Software License for MTL
Copyright (c) 2007-2008 The Trustees of Indiana University. All rights reserved.
Authors: Peter Gottschling and Andrew Lumsdaine
This file is part of the Matrix Template Library
See also license.mtl.txt in the distribution.
---------------------------------------------------------------
The Matrix Template Library
Version 4
I. Introduction
===============
The Matrix Template Library is a C++ class library for basic linear
algebra. The MTL is designed for high-performance while at the same
time taking advantage of the generic programming paradigm (ala the
STL) to allow much greater flexibility and breadth of
functionality. Many new and advanced programming techniques were used
in the construction of this library.
The MTL is a low level library in the sense that the user must be
conscious of the matrix type being used, and that all computationally
expensive operations are explicit. The MTL is not a C++ Matlab or
Mathematica. Nevertheless, the interface is designed to be simple and easy
to use.
The matrix types provided include compressed sparse row/column,
traditional row- and column-major dense, Morton-order, and block-recursive
matrices. All matrix types share a common and easy to use interface.
The algorithms consist of the traditional basic linear algebra
routines (from the BLAS level-1 to 3) which includes matrix and vector
arithmetic.
II. Compilers
=============
The Matrix Template Library is written in compliance with the C++ standard
and should be compilable with every compiler compliant with the standard.
It has been tested (and passed) with the following compilers and architectures:
Linux & MacOS
-------------
clang++ 3.0 (32 bit)
g++ 4.1.3 (32 and 64 bit)
g++ 4.2.4 (64bit)
g++ 4.3.4 (32 and 64 bit)
g++ 4.4.3 (32 and 64 bit)
g++ 4.5.1 (64 bit)
g++ 4.6.0 (64 bit)
g++ 4.6.1 (64 bit)
icc 9.1 (32 and 64 bit)
icc 10.0 (32 and 64 bit)
icc 10.1 (32 and 64 bit)
icc 11.0 (32 and 64 bit)
icc 11.1 (32 and 64 bit)
Windows
-------
VC 8.0 from Visual Studio 2005 (32 bit)
VC 9.0 from Visual Studio 2008 (32 bit)
VC 10.0 from Visual Studio 2010 (32 bit)
Compilers that are not standard-compliant (e.g. VC 6.0 from VS 2003) are not subject to support.
III. Documentation
==================
The documentation can be generated with doxygen in the main directory and
is found in the /libs/numeric/mtl/doc. You
can also view the documentation at our web site:
http://www.simunova.com/node/184
At the moment, the documentation illustrates the basic operations and
partially provides a reference manual of some classes and functions.
A detailed description of more features, especially tuning opportunities,
is in the works.
There are also a large number of examples in the /libs/numeric/mtl/examples
directory.
IV. Installation Procedure
==========================
See the file INSTALL in this directory.
V. Contact Information
=======================
The Matrix Template Library is available at the main distribution site:
http://www.mtl4.org
This distribution includes:
- Source code for the MTL (all header files /boost/numeric/mtl)
- Some completing sources (header files /boost/numeric/meta_math)
- A test suite (/libs/numeric/mtl/test)
- Some example code (/libs/numeric/mtl/examples)
Bug reports should be sent to mtl4@osl.iu.edu.
Questions, comments, suggestions, and requests for additional
information should also be directed to mtl4@osl.iu.edu.
Subscribe at:
http://www.osl.iu.edu/mailman/listinfo.cgi/mtl4
import getopt, sys, os, os.path, re, string
######################
# Helper functions
######################
# platform-dependent preprocessor definitions
def macro_flag(env, flag):
if sys.platform == 'win32' and conf.env['CC'] == 'cl':
return '/D' + flag
else:
return '-D' + flag
# add debugging flags to environment
def add_debug(env):
if sys.platform == 'win32' and conf.env['CC'] == 'cl':
env.Append(CCFLAGS = '/Z7')
env.Append(CCFLAGS = '/MDd')
else:
env.Append(CCFLAGS = '-g')
#print macro_flag(env, 'MTL_ASSERT_FOR_THROW')
env.Append(CCFLAGS = macro_flag(env, 'MTL_ASSERT_FOR_THROW'))
def check_g5():
print "platform ", sys.platform
if sys.platform == "darwin" :
system("/usr/bin/system_profiler SPHardwareDataType")
profile = os.popen("system_profiler SPHardwareDataType").read()
print profile
if profile.find("Mac G5") != -1:
print "is G5"
return 1
print "isn't G5"
return None
def add_platform_flags(env):
if env['CC'] == 'cl':
# Turn off some warnings: 1. for problems with CRTP 2. with VC's own headers
# 3. alleged ambiguos assignment
# I hope we find a cleaner way to get rid of this warning
wd = ' /wd4355 /wd4996 /wd4522'
env.Append(CCFLAGS = '/EHa /D_CONSOLE /D_CRT_SECURE_NO_DEPRECATE /DNOMINMAX' +
' /D_SECURE_SCL=0' + wd)
# The following two if shouldn't be necessary
# Note that INCLUDE must be split and LIB must not :-P
if os.environ.has_key('INCLUDE') :
for p in os.environ['INCLUDE'].split(';'):
env.Append(CPPPATH = p)
if os.environ.has_key('LIB') :
env.Append(LIBPATH = os.environ['LIB'])
# add optimization flags to environment
# normal optimization for opt=1, for opt=2 high optimization
# at the moment additional flags are added in this function
# -> this needs to be cleaned up!
def add_opt(env, opt):
if int(opt):
env.Append(CCFLAGS = macro_flag(env, 'NDEBUG'))
if sys.platform == 'win32' and conf.env['CC'] == 'cl':
if int(opt) == 1:
env.Append(CCFLAGS = '/O2 /Ot /Ob2')
elif int(opt) == 2:
env.Append(CCFLAGS = '/Ox')
env.Append(CCFLAGS = '/MD')
else:
if int(opt) == 2:
env.Append(CCFLAGS = '-O3')
if conf.env['CC'] == 'gcc':
env.Append(CCFLAGS = '-ffast-math')
#check_g5()
# env.Append(CCFLAGS = '-pg') # for profiling
# env.Append(LINKFLAGS = '-pg') # for profiling
elif int(opt) == 1:
env.Append(CCFLAGS = '-O2')
# env.Append(CCFLAGS = '-pg') # for profiling
# env.Append(LINKFLAGS = '-pg') # for profiling
if env['CC'] != 'cl':
env.Append(CXXFLAGS = conf.env['CCFLAGS'])
def check_no_long_double(conf):
cc = conf.env['CC']
if cc == 'gcc':
# conf.env.Append(CXXFLAGS = '-Werror -Wreorder -pedantic -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings')
output = os.popen(cc + " --version").read()
st = output.split('\n')[0]
tmatch = re.search(".* \(GCC\) (\d\.\d)", st)
if tmatch and string.atof(tmatch.group(1)) == 4.0:
conf.env.Append(CCFLAGS = '-Wno-long-double')
# conf.env.Append(CXXFLAGS = '-Wno-long-double')
def add_user_opt(env, add_optflag):
env.Append(CCFLAGS = add_optflag)
env.Append(CXXFLAGS = add_optflag)
###############################
# check for installed blas ...
# search different libraries
###############################
def detected_blas(env): # blas library found
env.Append(CPPDEFINES = 'MTL_HAS_BLAS')
def check_for_blas(env):
# symbolname
symname = 'dgemm_'
found_blas = 0
# get command line blas path
blas_path = ARGUMENTS.get('blas_path', '')
if blas_path:
print 'adding ' + blas_path + ' to LIBPATH.'
env.Append(LIBPATH = [ blas_path, blas_path + '/lib/' ])
# extra linker flags for blas
blas_ldflags = ARGUMENTS.get('blas_ldflags', '')
if blas_ldflags:
env.Append(_LIBFLAGS=blas_ldflags.split())
# get command line blas lib
blas_lib = ARGUMENTS.get('blas_lib', '')
if blas_lib:
myenv = env.Copy()
conf = Configure(myenv)
# check supplied lib
print "Checking for lib " + blas_lib + "..."
if conf.CheckLib(blas_lib, symname):
myenv = conf.Finish()
detected_blas(myenv)
myenv.Append(LIBS=[blas_lib])
return myenv
else:
print "Autodetecting BLAS support. See config.log for details!"
########################
# check for acml
myenv = env.Copy()
# new configure object
conf = Configure(myenv)
# additional libs needed for acml
myenv.Append(LIBS=['m', 'g2c'])
if conf.CheckLib('acml', symname):
detected_blas(myenv)
found_blas = 1
myenv = conf.Finish()
if(found_blas == 1):
return myenv
########################
# check for goto
myenv = env.Copy()
# new configure object
conf = Configure(myenv)
# additional libs needed for goto
myenv.Append(LIBS=['pthread'])
# extra linker flags for libgoto
# myenv.Append(_LIBFLAGS=['libs/numeric/mtl/build/xerbla.c'])
myenv.Append(_LIBFLAGS=['libs/numeric/mtl/build/xerbla.o']) # not portable !!!
# myenv.Library('build/xerbla', 'build/xerbla.c')
# myenv.Append(LIBS=['xerbla'])
# myenv.Append(LIBPATH=['build'])
if conf.CheckLib('goto', symname) or conf.CheckLib('goto_opteron-64', symname) or \
conf.CheckLib('goto_coppermine-32', symname) or conf.CheckLib('goto_opteron-32', symname) or \
conf.CheckLib('goto_itanium2-64', symname) or conf.CheckLib('goto_katmai-32', symname) or \
conf.CheckLib('goto_northwood-32', symname) or conf.CheckLib('goto_prescott-32', symname) or \
conf.CheckLib('goto_prescott-64', symname):
detected_blas(myenv)
found_blas = 1
myenv = conf.Finish()
if(found_blas == 1):
return myenv
########################
# check for ATLAS
myenv = env.Copy()
# new configure object
conf = Configure(myenv)
# additional libs needed for goto
myenv.Append(LIBS=['f77blas', 'g2c'])
if conf.CheckLib('atlas', symname):
detected_blas(myenv)
found_blas = 1
myenv = conf.Finish()
if(found_blas == 1):
return myenv
return env
###################################
# Add UMFPACK (extremely simplistic)
###################################
def detected_umfpack(env): # umfpack library found
env.Append(CPPDEFINES = 'MTL_HAS_UMFPACK')
def check_for_umfpack(env):
ufconfig_path = ARGUMENTS.get('ufconfig_path', '')
if ufconfig_path:
env.Prepend(CPPPATH = [ ufconfig_path ])
else:
print "UMFPACK only works with the UFconfig library."
print "Provide ufconfig_path."
print "Building continued without UMFPACK."
return env
amd_path = ARGUMENTS.get('amd_path', '')
if amd_path:
# print 'adding ' + amd_path + '/Lib to LIBPATH.'
env.Append(LIBPATH = [ amd_path + '/Lib' ])
#print 'adding ' + amd_path + '/Include to CPPPATH.'
env.Prepend(CPPPATH = [ amd_path + '/Include' ])
env.Prepend(LIBS=['amd'])
# print "nachher: ", env['CPPPATH']
else:
print "UMFPACK only works with the AMD library."
print "Provide amd_path."
print "Building continued without UMFPACK."
return env
# get command line umfpack path
umfpack_path = ARGUMENTS.get('umfpack_path', '')
if umfpack_path:
# print 'adding ' + umfpack_path + '/Lib to LIBPATH.'
env.Prepend(LIBPATH = [ umfpack_path + '/Lib' ])
env.Prepend(LIBS=['umfpack'])
# print 'adding ' + umfpack_path + '/Include to CPPPATH.'
env.Append(CPPPATH = [ umfpack_path + '/Include' ])
detected_umfpack(env)
return env
######################
# Start setting up env
######################
SourceSignatures('timestamp')
env = Environment()
# env.Decider('timestamp-newer')
conf = Configure(env)
check_no_long_double(conf)
env = conf.Finish()
# Search only for BLAS when explicitly asked for
with_blas = ARGUMENTS.get('with_blas', 0)
if int(with_blas):
env = check_for_blas(env)
# Search only for UMFPACK when explicitly asked for
with_umfpack = ARGUMENTS.get('with_umfpack', 0)
if int(with_umfpack):
env = check_for_umfpack(env)
######################
# Include paths
######################
my_cpppath = []
if os.environ.has_key('MTL_BOOST_ROOT') :
mtlp = os.environ['MTL_BOOST_ROOT']
my_cpppath.append(mtlp)
if os.environ.has_key('BOOST_ROOT') :
my_cpppath.append(os.environ['BOOST_ROOT'])
# In branches, the current directory is prepended
pwd = os.getcwd()
if not os.environ.has_key('MTL_BOOST_ROOT') \
or not hasattr(os.path, 'samefile') or not os.path.samefile(pwd, mtlp):
my_cpppath = [pwd] + my_cpppath
# Add directory of extern libraries if exist
# Not needed currently
#if os.path.exists('extern'):
# my_cpppath.append(os.path.abspath('extern'))
env.Append(CPPPATH = my_cpppath)
# Hack to select compiler explicitly
# env['CXX'] = 'g++-4.1'
######################
# Opt. and debug flags
######################
opts = Options()
opts.Add('opt', 'Set to 1 for normal optimization, 2 for high optimization', 0)
opts.Add('debug', 'Set to 1 for debugging', 0)
opts.Add('check', 'Set to 1 if test programs shall be ran', 0)
opts.Add('with_concepts', 'Set to 1 if test programs shall be compiled with conceptg++ (must be in ~/bin)', 0)
opts.Add('full_warnings', 'Set to 1 to turn on all possible warnings and transform into errors (currently only gcc)', 0)
opts.Add('add_ccflag', 'Add extra CC compiler flags that aren\'t automatically set', '')
opts.Add('add_cxxflag', 'Add extra CXX compiler flags that aren\'t automatically set', '')
opts.Add('add_optflag', 'Add extra optimization flags that aren\'t automatically set', '')
############
# BLAS flags
############
opts.Add('with_blas', 'Link with BLAS (have to given each time :-( until we can save configurations)', 0)
opts.Add('blas_path', 'Add path of blas library', '')
opts.Add('blas_lib', 'Add name of blas library', '')
opts.Add('blas_ldflags', 'Add LDFLAGS for blas library', '')
############
# UMFPACK flags
############
opts.Add('with_umfpack', 'Use UMFPACK. Needs umfpack_path and amd_path.', 0)
opts.Add('umfpack_path', 'Add path of UMFPACK library', '')
opts.Add('amd_path', 'Add path of AMD library', '')
opts.Add('ufconfig_path', 'Add path of AMD library', '')
Help(opts.GenerateHelpText(env))
#env.Append(CCFLAGS = ARGUMENTS.get('debug', ''))
# Hack, for test only
# env.Replace(CXX = '/san/intel/cc/9.0/bin/icc')
# To test with conceptg++
# requires
if int(ARGUMENTS.get('with_concepts', 0)):
env['CXX'] = '~/bin/conceptg++'
env.Append(CCFLAGS = macro_flag(env, 'CONCEPTS_WITHOUT_OVERLOADED_REQUIREMENTS'))
# Full warnings and treat as errors
if int(ARGUMENTS.get('full_warnings', 0)):
if env['CXX'] == 'g++':
env.Append(CXXFLAGS = '-Werror -Wall -Wreorder -pedantic -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings')
full_warnings = ARGUMENTS.get('full_warnings', 0)
# add user-defined CC flags
add_ccflag = ARGUMENTS.get('add_ccflag', '')
if add_ccflag:
env.Append(CCFLAGS = add_ccflag)