ShyLU: extern BLAS function declaration breaks Sierra build
Created by: mhoemmen
@mwglass reports the following build error, resulting from ShyLU exposing extern
declarations of BLAS functions in header files, that conflict with extern
declarations in Sierra (specifically FETI-DP):
In file included from .../sierra.base.trilinos/TPLs_src/Trilinos_flat_headers/include/shylu_hts.hpp:47:0,
from .../sierra.base.trilinos/TPLs_src/solversNGP/Npt/NptHtsInterface.hpp:5,
from .../sierra.base.trilinos/TPLs_src/solversNGP/Npt/SolverNpt.hpp:23,
from .../sierra.base.trilinos/FETI-DP/src/NPTEquationSolver.h:28,
from .../sierra.base.trilinos/FETI-DP/src/CoarseNPTEquationSolver.h:15,
from .../sierra.base.trilinos/FETI-DP/src/CoarseNPTEquationSolver.C:11:
.../sierra.base.trilinos/TPLs_src/Trilinos_flat_headers/include/shylu_hts_impl_def.hpp:112:49: error: declaration of 'void Experimental::htsimpl::sgemm_(char*, char*, Experimental::htsimpl::blas_int*, Experimental::htsimpl::blas_int*, Experimental::htsimpl::blas_int*, float*, float*, Experimental::htsimpl::blas_int*, float*, Experimental::htsimpl::blas_int*, float*, float*, Experimental::htsimpl::blas_int*)' with C language linkage [-Werror]
float*, blas_int*, float*, float*, blas_int*);
^
In file included from .../sierra.base.trilinos/FETI-DP/src/feti_blas.h:12:0,
from .../sierra.base.trilinos/FETI-DP/src/ftl_math.h:22,
from .../sierra.base.trilinos/FETI-DP/src/DataVector.h:18,
from .../sierra.base.trilinos/FETI-DP/src/CoarseNPTEquationSolver.h:14,
from .../sierra.base.trilinos/FETI-DP/src/CoarseNPTEquationSolver.C:11:
.../sierra.base.trilinos/FETI-DP/src/feti_blas.h:90:15: error: conflicts with previous declaration 'void feti::sgemm_(const char*, const char*, const int*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*)' [-Werror]
void _FORTRAN(sgemm)(const char*, const char*, const int* m, const int* n, const int* k, const float* alpha, const float* A, const int* lda, const float* B, const int* ldb,
@trilinos/shylu @crdohrm
Expectations
Trilinos should not cause build errors in downstream libraries or applications that make extern
declarations of BLAS, etc. functions.
Possible Solution
Mike and I discussed this. We decided that the best policy would be for upstream libraries, like Trilinos, never to expose any of the following to applications:
- TPL header file includes (see e.g., #1194 (closed))
-
extern
declarations of TPL functions (e.g., from the BLAS)
This implies hiding TPL includes and extern
declarations in a .cpp file. This solution would add effort to kokkos-kernels development and issues such as #1195 (closed), but it will solve all problems of this sort for all downstream libraries and applications. It also improves encapsulation, a standard good software engineering practice.