Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
64cf828f
There was an error fetching the commit references. Please try again later.
Commit
64cf828f
authored
5 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Fixed linking to a BLAS library on Centos systems
parent
c11b5805
No related branches found
No related tags found
1 merge request
!47
Linear solvers
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Benchmarks/BLAS/CMakeLists.txt
+18
-6
18 additions, 6 deletions
src/Benchmarks/BLAS/CMakeLists.txt
src/Benchmarks/BLAS/blasWrappers.h
+6
-0
6 additions, 0 deletions
src/Benchmarks/BLAS/blasWrappers.h
with
24 additions
and
6 deletions
src/Benchmarks/BLAS/CMakeLists.txt
+
18
−
6
View file @
64cf828f
...
@@ -5,16 +5,28 @@ else()
...
@@ -5,16 +5,28 @@ else()
add_executable
(
tnl-benchmark-blas tnl-benchmark-blas.cpp
)
add_executable
(
tnl-benchmark-blas tnl-benchmark-blas.cpp
)
endif
()
endif
()
find_library
(
CBLAS_LIBRARY NAMES cblas
find_library
(
CBLAS_LIBRARY NAMES cblas
)
PATHS /usr/lib
/usr/lib64
# fallback for Centos 7.5 - libcblas.so does not exist, link to libtatlas.so or libsatlas.so
/usr/lib/x86_64-linux-gnu
# https://forums.centos.org/viewtopic.php?t=48543
/usr/local/lib
find_library
(
TATLAS_LIBRARY NAMES tatlas
/usr/local/lib64
)
PATH_SUFFIXES atlas
)
find_library
(
SATLAS_LIBRARY NAMES satlas
PATH_SUFFIXES atlas
)
if
(
CBLAS_LIBRARY
)
if
(
CBLAS_LIBRARY
)
target_compile_definitions
(
tnl-benchmark-blas PUBLIC
"-DHAVE_BLAS"
)
target_compile_definitions
(
tnl-benchmark-blas PUBLIC
"-DHAVE_BLAS"
)
target_link_libraries
(
tnl-benchmark-blas
${
CBLAS_LIBRARY
}
)
target_link_libraries
(
tnl-benchmark-blas
${
CBLAS_LIBRARY
}
)
elseif
(
TATLAS_LIBRARY
)
target_compile_definitions
(
tnl-benchmark-blas PUBLIC
"-DHAVE_BLAS"
)
target_link_libraries
(
tnl-benchmark-blas
${
TATLAS_LIBRARY
}
)
elseif
(
SATLAS_LIBRARY
)
target_compile_definitions
(
tnl-benchmark-blas PUBLIC
"-DHAVE_BLAS"
)
target_link_libraries
(
tnl-benchmark-blas
${
SATLAS_LIBRARY
}
)
else
()
else
()
# FIXME: We require the CBLAS interface, but CMake's FindBLAS cannot detect that,
# so this fails unless the BLAS implementation includes it in the same
# shared library file as the Fortran implementation (e.g. OpenBLAS does that).
find_package
(
BLAS
)
find_package
(
BLAS
)
if
(
BLAS_FOUND
)
if
(
BLAS_FOUND
)
target_compile_definitions
(
tnl-benchmark-blas PUBLIC
"-DHAVE_BLAS"
)
target_compile_definitions
(
tnl-benchmark-blas PUBLIC
"-DHAVE_BLAS"
)
...
...
This diff is collapsed.
Click to expand it.
src/Benchmarks/BLAS/blasWrappers.h
+
6
−
0
View file @
64cf828f
...
@@ -2,7 +2,13 @@
...
@@ -2,7 +2,13 @@
#ifdef HAVE_BLAS
#ifdef HAVE_BLAS
// HOTFIX: cblas.h from the atlas-devel package (version 3.10.1-12.el7) on CentOS 7
// does not declare the functions as `extern "C"`, which breaks name mangling.
// Note that nested `extern "C"` is valid and correct:
// https://stackoverflow.com/questions/48099828/what-happens-if-you-nest-extern-c
extern
"C"
{
#include
<cblas.h>
#include
<cblas.h>
}
inline
int
blasIgamax
(
int
n
,
const
float
*
x
,
int
incx
)
inline
int
blasIgamax
(
int
n
,
const
float
*
x
,
int
incx
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment