Skip to content

Commit 827c50b

Browse files
authored
Implemented --omit-symbols=LIST configure option. (flame#823)
Details: - Added a new option to 'configure' that allows the user to specify a list of symbols to omit from the library. The format of the option is --omit-symbols=LIST where LIST is a comma-separated list of symbol names (excluding any trailing underscore). This list is parsed into a list of #define directives that causes the relevant parts of BLIS to be ignored (or not). As such, the nature of this option is to only support omitting symbols which have been pre-identified as potential troublemakers when linking BLIS with other libraries such as LAPACK or ScaLAPACK. (This list may grow in the future as additional symbols are identified.) Note: we leave lsame_() and xerbla_() prototypes enabled even when their respective symbols are omitted from the library. - Re-implemented the --enable-scalapack-compat configure option to utilize the underlying --omit-symbols=LIST infrastructure. - Implemented an --enable-lapack-compat option, which omits all of the known problematic symbols currently supported for omission. - This commit addresses Issue flame#816. Thanks to Timo Betcke for bringing it to our attention and to Devin Matthews for his advice and for his initial implementation of --enable-scalapack-compat (PR flame#813). - CREDITS file update.
1 parent b36bc95 commit 827c50b

17 files changed

+204
-68
lines changed

CREDITS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ but many others have contributed code, ideas, and feedback, including
1919
Abhishek Bagusetty @abagusetty (Argonne National Laboratory)
2020
Satish Balay @balay (Argonne National Laboratory)
2121
Kihiro Bando @bandokihiro
22+
Timo Betcke @tbetcke (University College London)
2223
Matthew Brett @matthew-brett (University of Birmingham)
2324
Jérémie du Boisberranger @jeremiedbb
2425
Jed Brown @jedbrown (Argonne National Laboratory)

build/bli_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
// Enabled kernel sets (kernel_list)
4646
@kernel_list_defines@
4747

48+
// Disabled symbols (symbol_omit_list)
49+
@omit_symbol_list_defines@
50+
4851
#define BLIS_VERSION_STRING "@version@"
4952

5053
#if @enable_system@

configure

Lines changed: 130 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,50 @@ print_usage()
144144
library. If the shared library build is disabled, the
145145
static library build must remain enabled.
146146
147+
--omit-symbols=LIST
148+
149+
Omit a custom set of compatibility symbols when building
150+
BLIS. When given, LIST is parsed as a comma-separated
151+
list of symbol names (excluding any trailing underscore).
152+
This option is useful when (1) the user is planning to
153+
link BLIS with another library that provides conflicting
154+
symbols, and (2) the user wishes the symbols in this
155+
other library to prevail at link time without relying on
156+
weak/strong symbol semantics. Note that currently ONLY
157+
the following symbols are supported for omission:
158+
159+
crot zrot lsame
160+
csymv zsymv xerbla
161+
csyr zsyr xerbla_array
162+
csyr2 zsyr2
163+
164+
--enable-lapack-compat, --disable-lapack-compat
165+
166+
Enable strict compatibility with LAPACK. This option
167+
causes BLIS to be built without some routines that we
168+
consider to be BLAS compatibility routines but that
169+
also happen to be provided by LAPACK. This option is
170+
equivalent to using the --omit-symbols=LIST option
171+
where LIST contains the following symbols:
172+
173+
crot zrot lsame
174+
csymv zsymv xerbla
175+
csyr zsyr xerbla_array
176+
csyr2 zsyr2
177+
178+
--enable-scalapack-compat, --disable-scalapack-compat
179+
180+
Enable strict compatibility with ScaLAPACK. This option
181+
causes BLIS to be built without some routines that we
182+
consider to be BLAS compatibility routines but that
183+
also happen to be provided by ScaLAPACK. This option is
184+
equivalent to using the --omit-symbols=LIST option
185+
where LIST contains the following symbols:
186+
187+
csymv zsymv
188+
csyr zsyr
189+
csyr2 zsyr2
190+
147191
--enable-rpath, --disable-rpath
148192
149193
Enable (disabled by default) setting an install_name for
@@ -303,12 +347,6 @@ print_usage()
303347
which are determined by the BLIS subconfiguration used at
304348
runtime.) By default, these customized files are disabled.
305349
306-
--enable-scalapack-compat, --disable-scalapack-compat
307-
308-
Enable strict compatibility with ScaLAPACK, which may
309-
requiring disabling certain conflicting functionality
310-
available through the BLAS and/or CBLAS interfaces.
311-
312350
-a NAME --enable-addon=NAME
313351
314352
Enable the code provided by an addon. An addon consists
@@ -3015,10 +3053,14 @@ blis_main()
30153053
enable_amd_frame_tweaks='no'
30163054
enable_memkind='' # The default memkind value is determined later on.
30173055
enable_trsm_preinversion='yes'
3056+
enable_lapack_compat='no'
30183057
enable_scalapack_compat='no'
30193058
force_version='no'
30203059
complex_return='default'
30213060

3061+
# The symbol omission list.
3062+
omit_symbol_list=''
3063+
30223064
# The addon flag and names.
30233065
addon_flag=''
30243066
addon_list=''
@@ -3155,6 +3197,10 @@ blis_main()
31553197
enable_shared='no'
31563198
;;
31573199

3200+
omit-symbols=*)
3201+
omit_symbol_list=${OPTARG#*=}
3202+
;;
3203+
31583204
enable-rpath)
31593205
enable_rpath='yes'
31603206
;;
@@ -3272,6 +3318,13 @@ blis_main()
32723318
enable_amd_frame_tweaks='no'
32733319
;;
32743320

3321+
enable-lapack-compat)
3322+
enable_lapack_compat='yes'
3323+
;;
3324+
disable-lapack-compat)
3325+
enable_lapack_compat='no'
3326+
;;
3327+
32753328
enable-scalapack-compat)
32763329
enable_scalapack_compat='yes'
32773330
;;
@@ -3675,6 +3728,54 @@ blis_main()
36753728
exit 1
36763729
fi
36773730

3731+
# Check for the LAPACK compatibility option before the option for symbol
3732+
# omission since the former can imply/augment the latter.
3733+
if [[ ${enable_lapack_compat} = yes ]]; then
3734+
echo "${script_name}: LAPACK compatibility is enabled."
3735+
enable_lapack_compat_01=1
3736+
problematic_symbols="crot,zrot,csymv,zsymv,csyr,zsyr,csyr2,zsyr2,lsame,xerbla,xerbla_array"
3737+
omit_symbol_list="${omit_symbol_list},${problematic_symbols}"
3738+
else
3739+
echo "${script_name}: LAPACK compatibility is disabled."
3740+
enable_lapack_compat_01=0
3741+
fi
3742+
3743+
# Check for the ScaLAPACK compatibility option before the option for symbol
3744+
# omission since the former can imply/augment the latter.
3745+
if [[ ${enable_scalapack_compat} = yes ]]; then
3746+
echo "${script_name}: ScaLAPACK compatibility is enabled."
3747+
enable_scalapack_compat_01=1
3748+
problematic_symbols="csymv,zsymv,csyr,zsyr,csyr2,zsyr2"
3749+
omit_symbol_list="${omit_symbol_list},${problematic_symbols}"
3750+
else
3751+
echo "${script_name}: ScaLAPACK compatibility is disabled."
3752+
enable_scalapack_compat_01=0
3753+
fi
3754+
3755+
# Check if we are omitting any symbols.
3756+
if [[ ${omit_symbol_list} != "" ]]; then
3757+
3758+
# Create a list of #defines, one for each symbol the user requested
3759+
# that we omit. Note that first we convert the list's commas into
3760+
# spaces.
3761+
3762+
# Start by changing the comma-separated list to a space-separated list.
3763+
omit_symbol_list=$(echo "${omit_symbol_list}" | sed -e "s/,/ /g")
3764+
3765+
# Remove duplicates.
3766+
#omit_symbol_list=$(rm_duplicate_words_simple "${omit_symbol_list}")
3767+
3768+
# Sort the list, removing duplicates (via -u).
3769+
omit_symbol_list=$(echo "${omit_symbol_list}" | xargs -n1 | sort -u)
3770+
3771+
echo "${script_name}: omitting the following symbols from BLIS:"
3772+
for omit_symbol_name in ${omit_symbol_list}; do
3773+
echo "${script_name}: ${omit_symbol_name}"
3774+
done
3775+
else
3776+
echo "${script_name}: no symbols will be omitted."
3777+
fi
3778+
36783779
# Check if we are building with or without operating system support.
36793780
if [[ ${enable_system} = yes ]]; then
36803781
echo "${script_name}: enabling operating system support."
@@ -3947,13 +4048,6 @@ blis_main()
39474048
echo "${script_name}: memory tracing output is disabled."
39484049
enable_mem_tracing_01=0
39494050
fi
3950-
if [[ ${enable_scalapack_compat} = yes ]]; then
3951-
echo "${script_name}: ScaLAPACK compatibility is enabled."
3952-
enable_scalapack_compat_01=1
3953-
else
3954-
echo "${script_name}: ScaLAPACK compatibility is disabled."
3955-
enable_scalapack_compat_01=0
3956-
fi
39574051
if [[ ${has_memkind} = yes ]]; then
39584052
if [[ -z ${enable_memkind} ]]; then
39594053
# If no explicit option was given for libmemkind one way or the other,
@@ -4216,6 +4310,28 @@ blis_main()
42164310
addon_list_includes="${addon_list_includes}#include ${addon_header}\n"
42174311
done
42184312

4313+
# Make sure that omit_symbol_list only contains lowercase letters, digits,
4314+
# underscores, and commas.
4315+
omit_symbol_list_check=$(echo "${omit_symbol_list}" | sed -e "s/[a-z0-9_, ]//g")
4316+
4317+
if [[ "${omit_symbol_list_check}" != "" ]]; then
4318+
echo "${script_name}: --omit-symbol=LIST option contains unexpected characters: ${omit_symbol_list_check}"
4319+
exit 1
4320+
fi
4321+
4322+
# Create a list of #defines, one for each symbol the user requested that we
4323+
# omit. Note that first we convert the list's commas into spaces.
4324+
omit_symbol_list=$(echo "${omit_symbol_list}" | sed -e "s/,/ /g")
4325+
for sym in ${omit_symbol_list}; do
4326+
4327+
# Convert the current config name to uppercase.
4328+
sym=$(echo "${sym}" | tr '[:lower:]' '[:upper:]')
4329+
4330+
# Create a #define and add it to the running list.
4331+
omit_define="BLIS_DISABLE_${sym}"
4332+
omit_symbol_list_defines="${omit_symbol_list_defines}#define ${omit_define}\n"
4333+
done
4334+
42194335

42204336
# -- Determine whether we are performing an out-of-tree build --------------
42214337

@@ -4310,6 +4426,7 @@ blis_main()
43104426
add_config_var config_name_define
43114427
add_config_var config_list_defines
43124428
add_config_var kernel_list_defines
4429+
add_config_var omit_symbol_list_defines
43134430
add_config_var enable_tls enable_tls_01
43144431
add_config_var enable_openmp enable_openmp_01
43154432
add_config_var enable_openmp_as_def enable_openmp_as_def_01

frame/compat/bla_symv.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ void PASTEF77(ch,blasname) \
112112
}
113113

114114
#ifdef BLIS_ENABLE_BLAS
115-
#ifdef BLIS_ENABLE_SCALAPACK_COMPAT
116-
INSERT_GENTFUNCRO_BLAS( symv, symv )
117-
#else
118-
INSERT_GENTFUNC_BLAS( symv, symv )
115+
GENTFUNC( float, s, symv, symv )
116+
GENTFUNC( double, d, symv, symv )
117+
#ifndef BLIS_DISABLE_CSYMV
118+
GENTFUNC( scomplex, c, symv, symv )
119+
#endif
120+
#ifndef BLIS_DISABLE_ZSYMV
121+
GENTFUNC( dcomplex, z, symv, symv )
119122
#endif
120123
#endif
121-

frame/compat/bla_symv.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@
3232
3333
*/
3434

35-
#if 1
36-
3735
//
3836
// Prototype BLAS-to-BLIS interfaces.
3937
//
4038
#undef GENTPROT
41-
#undef GENTPROTRO
42-
#define GENTPROTRO GENTPROT
4339
#define GENTPROT( ftype, ch, blasname ) \
4440
\
4541
BLIS_EXPORT_BLAS void PASTEF77(ch,blasname) \
@@ -54,12 +50,12 @@ BLIS_EXPORT_BLAS void PASTEF77(ch,blasname) \
5450
);
5551

5652
#ifdef BLIS_ENABLE_BLAS
57-
#ifdef BLIS_ENABLE_SCALAPACK_COMPAT
58-
INSERT_GENTPROTRO_BLAS( symv )
59-
#else
60-
INSERT_GENTPROT_BLAS( symv )
53+
GENTPROT( float, s, symv )
54+
GENTPROT( double, d, symv )
55+
#ifndef BLIS_DISABLE_CSYMV
56+
GENTPROT( scomplex, c, symv )
6157
#endif
58+
#ifndef BLIS_DISABLE_ZSYMV
59+
GENTPROT( dcomplex, z, symv )
6260
#endif
63-
6461
#endif
65-

frame/compat/bla_syr.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ void PASTEF77(ch,blasname) \
103103
}
104104

105105
#ifdef BLIS_ENABLE_BLAS
106-
#ifdef BLIS_ENABLE_SCALAPACK_COMPAT
107-
INSERT_GENTFUNCRO_BLAS( syr, syr )
108-
#else
109-
INSERT_GENTFUNC_BLAS( syr, syr )
106+
GENTFUNC( float, s, syr, syr )
107+
GENTFUNC( double, d, syr, syr )
108+
#ifndef BLIS_DISABLE_CSYR
109+
GENTFUNC( scomplex, c, syr, syr )
110+
#endif
111+
#ifndef BLIS_DISABLE_ZSYR
112+
GENTFUNC( dcomplex, z, syr, syr )
110113
#endif
111114
#endif
112-

frame/compat/bla_syr.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@
3232
3333
*/
3434

35-
#if 1
36-
3735
//
3836
// Prototype BLAS-to-BLIS interfaces.
3937
//
4038
#undef GENTPROT
41-
#undef GENTPROTRO
42-
#define GENTPROTRO GENTPROT
4339
#define GENTPROT( ftype, ch, blasname ) \
4440
\
4541
BLIS_EXPORT_BLAS void PASTEF77(ch,blasname) \
@@ -52,12 +48,12 @@ BLIS_EXPORT_BLAS void PASTEF77(ch,blasname) \
5248
);
5349

5450
#ifdef BLIS_ENABLE_BLAS
55-
#ifdef BLIS_ENABLE_SCALAPACK_COMPAT
56-
INSERT_GENTPROTRO_BLAS( syr )
57-
#else
58-
INSERT_GENTPROT_BLAS( syr )
51+
GENTPROT( float, s, syr )
52+
GENTPROT( double, d, syr )
53+
#ifndef BLIS_DISABLE_CSYR
54+
GENTPROT( scomplex, c, syr )
5955
#endif
56+
#ifndef BLIS_DISABLE_ZSYR
57+
GENTPROT( dcomplex, z, syr )
6058
#endif
61-
6259
#endif
63-

frame/compat/bla_syr2.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
// Define BLAS-to-BLIS interfaces.
4040
//
4141
#undef GENTFUNC
42-
#undef GENTFUNCRO
43-
#define GENTFUNCRO GENTFUNC
4442
#define GENTFUNC( ftype, ch, blasname, blisname ) \
4543
\
4644
void PASTEF77(ch,blasname) \
@@ -111,10 +109,12 @@ void PASTEF77(ch,blasname) \
111109
}
112110

113111
#ifdef BLIS_ENABLE_BLAS
114-
#ifdef BLIS_ENABLE_SCALAPACK_COMPAT
115-
INSERT_GENTFUNCRO_BLAS( syr2, syr2 )
116-
#else
117-
INSERT_GENTFUNC_BLAS( syr2, syr2 )
112+
GENTFUNC( float, s, syr2, syr2 )
113+
GENTFUNC( double, d, syr2, syr2 )
114+
#ifndef BLIS_DISABLE_CSYR2
115+
GENTFUNC( scomplex, c, syr2, syr2 )
116+
#endif
117+
#ifndef BLIS_DISABLE_ZSYR2
118+
GENTFUNC( dcomplex, z, syr2, syr2 )
118119
#endif
119120
#endif
120-

frame/compat/bla_syr2.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@
3232
3333
*/
3434

35-
#if 1
36-
3735
//
3836
// Prototype BLAS-to-BLIS interfaces.
3937
//
4038
#undef GENTPROT
41-
#undef GENTPROTRO
42-
#define GENTPROTRO GENTPROT
4339
#define GENTPROT( ftype, ch, blasname ) \
4440
\
4541
BLIS_EXPORT_BLAS void PASTEF77(ch,blasname) \
@@ -53,12 +49,12 @@ BLIS_EXPORT_BLAS void PASTEF77(ch,blasname) \
5349
);
5450

5551
#ifdef BLIS_ENABLE_BLAS
56-
#ifdef BLIS_ENABLE_SCALAPACK_COMPAT
57-
INSERT_GENTPROTRO_BLAS( syr2 )
58-
#else
59-
INSERT_GENTPROT_BLAS( syr2 )
52+
GENTPROT( float, s, syr2 )
53+
GENTPROT( double, d, syr2 )
54+
#ifndef BLIS_DISABLE_CSYR2
55+
GENTPROT( scomplex, c, syr2 )
6056
#endif
57+
#ifndef BLIS_DISABLE_ZSYR2
58+
GENTPROT( dcomplex, z, syr2 )
6159
#endif
62-
6360
#endif
64-

0 commit comments

Comments
 (0)