2015-01-31 01:21:50 +08:00
2016-05-25 15:13:28 +08:00
include_directories ( ${ PROJECT_SOURCE_DIR } )
2015-01-31 01:21:50 +08:00
2015-08-11 03:10:44 +08:00
2015-02-03 06:25:30 +08:00
set ( BLAS1_SOURCES
2015-02-18 00:30:28 +08:00
c o p y . c
2015-08-11 03:10:44 +08:00
n r m 2 . c
2015-02-18 00:30:28 +08:00
)
set ( BLAS1_REAL_ONLY_SOURCES
r o t m . c r o t m g . c # N.B. these do not have complex counterparts
2015-08-11 03:10:44 +08:00
r o t . c
a s u m . c
2015-02-18 00:30:28 +08:00
)
# these will have 'z' prepended for the complex version
set ( BLAS1_MANGLED_SOURCES
2015-02-03 06:25:30 +08:00
a x p y . c s w a p . c
2015-02-18 00:30:28 +08:00
s c a l . c
2015-02-03 06:25:30 +08:00
d o t . c
2015-08-11 03:10:44 +08:00
r o t g . c
2015-02-03 06:25:30 +08:00
a x p b y . c
)
# TODO: USE_NETLIB_GEMV shoudl switch gemv.c to netlib/*gemv.f
2015-02-18 00:30:28 +08:00
# these all have 'z' sources for complex versions
2015-02-03 06:25:30 +08:00
set ( BLAS2_SOURCES
g e m v . c g e r . c
t r s v . c t r m v . c s y m v . c
s y r . c s y r 2 . c g b m v . c
s b m v . c s p m v . c
s p r . c s p r 2 . c
t b s v . c t b m v . c
t p s v . c t p m v . c
)
2015-08-11 03:10:44 +08:00
set ( BLAS2_COMPLEX_ONLY_MANGLED_SOURCES
h e m v . c h b m v . c
h e r . c h e r 2 . c
h p m v . c h p r . c
h p r 2 . c
)
2015-02-18 03:12:30 +08:00
# these do not have separate 'z' sources
2015-02-03 06:25:30 +08:00
set ( BLAS3_SOURCES
g e m m . c s y m m . c
t r s m . c s y r k . c s y r 2 k . c
2015-02-18 00:30:28 +08:00
)
set ( BLAS3_MANGLED_SOURCES
2015-02-03 06:25:30 +08:00
o m a t c o p y . c i m a t c o p y . c
2015-08-11 03:10:44 +08:00
g e a d d . c
2015-02-03 06:25:30 +08:00
)
2015-02-05 01:30:15 +08:00
# generate the BLAS objs once with and once without cblas
set ( CBLAS_FLAGS "" )
2015-02-03 06:25:30 +08:00
if ( NOT DEFINED NO_FBLAS )
2015-02-05 01:30:15 +08:00
list ( APPEND CBLAS_FLAGS 0 )
endif ( )
if ( NOT DEFINED NO_CBLAS )
list ( APPEND CBLAS_FLAGS 1 )
endif ( )
2015-02-03 02:31:15 +08:00
2015-02-05 01:30:15 +08:00
foreach ( CBLAS_FLAG ${ CBLAS_FLAGS } )
2015-02-18 03:12:30 +08:00
# TODO: don't compile complex sources with cblas for now, the naming schemes are all different and they will have to be handled separately from SINGLE/DOUBLE
set ( DISABLE_COMPLEX 0 )
set ( MANGLE_COMPLEX 3 )
if ( CBLAS_FLAG EQUAL 1 )
2015-10-21 03:37:22 +08:00
# set(DISABLE_COMPLEX 1)
# set(MANGLE_COMPLEX 1)
2015-02-18 03:12:30 +08:00
endif ( )
GenerateNamedObjects ( "${BLAS1_SOURCES}" "" "" ${ CBLAS_FLAG } "" "" false ${ DISABLE_COMPLEX } )
GenerateNamedObjects ( "${BLAS1_REAL_ONLY_SOURCES}" "" "" ${ CBLAS_FLAG } "" "" false 1 )
GenerateNamedObjects ( "${BLAS1_MANGLED_SOURCES}" "" "" ${ CBLAS_FLAG } "" "" false ${ MANGLE_COMPLEX } )
GenerateNamedObjects ( "${BLAS2_SOURCES}" "" "" ${ CBLAS_FLAG } "" "" false ${ MANGLE_COMPLEX } )
2015-08-11 03:10:44 +08:00
GenerateNamedObjects ( "${BLAS2_COMPLEX_ONLY_MANGLED_SOURCES}" "" "" ${ CBLAS_FLAG } "" "" false 4 )
2015-02-18 03:12:30 +08:00
GenerateNamedObjects ( "${BLAS3_SOURCES}" "" "" ${ CBLAS_FLAG } "" "" false ${ DISABLE_COMPLEX } )
GenerateNamedObjects ( "${BLAS3_MANGLED_SOURCES}" "" "" ${ CBLAS_FLAG } "" "" false ${ MANGLE_COMPLEX } )
2015-02-03 02:31:15 +08:00
2015-08-11 03:10:44 +08:00
#sdsdot, dsdot
GenerateNamedObjects ( "sdsdot.c" "" "sdsdot" ${ CBLAS_FLAG } "" "" true "SINGLE" )
GenerateNamedObjects ( "dsdot.c" "" "dsdot" ${ CBLAS_FLAG } "" "" true "SINGLE" )
2015-02-03 02:31:15 +08:00
# trmm is trsm with a compiler flag set
2015-02-16 07:44:37 +08:00
GenerateNamedObjects ( "trsm.c" "TRMM" "trmm" ${ CBLAS_FLAG } )
2015-02-05 00:52:19 +08:00
# max and imax are compiled 4 times
2015-02-16 07:44:37 +08:00
GenerateNamedObjects ( "max.c" "" "" ${ CBLAS_FLAG } )
GenerateNamedObjects ( "max.c" "USE_ABS" "amax" ${ CBLAS_FLAG } )
GenerateNamedObjects ( "max.c" "USE_ABS;USE_MIN" "amin" ${ CBLAS_FLAG } )
GenerateNamedObjects ( "max.c" "USE_MIN" "min" ${ CBLAS_FLAG } )
2015-02-05 00:52:19 +08:00
2015-02-16 07:44:37 +08:00
GenerateNamedObjects ( "imax.c" "" "i*max" ${ CBLAS_FLAG } )
GenerateNamedObjects ( "imax.c" "USE_ABS" "i*amax" ${ CBLAS_FLAG } )
GenerateNamedObjects ( "imax.c" "USE_ABS;USE_MIN" "i*amin" ${ CBLAS_FLAG } )
GenerateNamedObjects ( "imax.c" "USE_MIN" "i*min" ${ CBLAS_FLAG } )
2015-02-03 02:31:15 +08:00
2015-02-23 07:49:28 +08:00
# complex-specific sources
foreach ( float_type ${ FLOAT_TYPES } )
2015-08-11 03:10:44 +08:00
2015-02-23 07:49:28 +08:00
if ( ${ float_type } STREQUAL "COMPLEX" OR ${ float_type } STREQUAL "ZCOMPLEX" )
2015-10-21 03:37:22 +08:00
GenerateNamedObjects ( "zger.c" "" "geru" ${ CBLAS_FLAG } "" "" false ${ float_type } )
GenerateNamedObjects ( "zger.c" "CONJ" "gerc" ${ CBLAS_FLAG } "" "" false ${ float_type } )
GenerateNamedObjects ( "zdot.c" "CONJ" "dotc" ${ CBLAS_FLAG } "" "" false ${ float_type } )
GenerateNamedObjects ( "zdot.c" "" "dotu" ${ CBLAS_FLAG } "" "" false ${ float_type } )
2015-08-11 03:10:44 +08:00
2015-10-21 03:37:22 +08:00
GenerateNamedObjects ( "symm.c" "HEMM" "hemm" ${ CBLAS_FLAG } "" "" false ${ float_type } )
GenerateNamedObjects ( "syrk.c" "HEMM" "herk" ${ CBLAS_FLAG } "" "" false ${ float_type } )
GenerateNamedObjects ( "syr2k.c" "HEMM" "her2k" ${ CBLAS_FLAG } "" "" false ${ float_type } )
2015-08-11 03:10:44 +08:00
if ( USE_GEMM3M )
GenerateNamedObjects ( "gemm.c" "GEMM3M" "gemm3m" false "" "" false ${ float_type } )
endif ( )
2015-02-23 07:49:28 +08:00
endif ( )
if ( ${ float_type } STREQUAL "COMPLEX" )
2015-10-21 03:37:22 +08:00
GenerateNamedObjects ( "zscal.c" "SSCAL" "sscal" ${ CBLAS_FLAG } "" "" false "COMPLEX" )
GenerateNamedObjects ( "nrm2.c" "" "scnrm2" ${ CBLAS_FLAG } "" "" true "COMPLEX" )
GenerateNamedObjects ( "zrot.c" "" "csrot" ${ CBLAS_FLAG } "" "" true "COMPLEX" )
GenerateNamedObjects ( "max.c" "USE_ABS;USE_MIN" "scamin" ${ CBLAS_FLAG } "" "" true "COMPLEX" )
GenerateNamedObjects ( "max.c" "USE_ABS" "scamax" ${ CBLAS_FLAG } "" "" true "COMPLEX" )
GenerateNamedObjects ( "asum.c" "" "scasum" ${ CBLAS_FLAG } "" "" true "COMPLEX" )
2015-02-23 07:49:28 +08:00
endif ( )
if ( ${ float_type } STREQUAL "ZCOMPLEX" )
2015-10-21 03:37:22 +08:00
GenerateNamedObjects ( "zscal.c" "SSCAL" "dscal" ${ CBLAS_FLAG } "" "" false "ZCOMPLEX" )
GenerateNamedObjects ( "nrm2.c" "" "dznrm2" ${ CBLAS_FLAG } "" "" true "ZCOMPLEX" )
GenerateNamedObjects ( "zrot.c" "" "zdrot" ${ CBLAS_FLAG } "" "" true "ZCOMPLEX" )
GenerateNamedObjects ( "max.c" "USE_ABS;USE_MIN" "dzamin" ${ CBLAS_FLAG } "" "" true "ZCOMPLEX" )
GenerateNamedObjects ( "max.c" "USE_ABS" "dzamax" ${ CBLAS_FLAG } "" "" true "ZCOMPLEX" )
GenerateNamedObjects ( "asum.c" "" "dzasum" ${ CBLAS_FLAG } "" "" true "ZCOMPLEX" )
2015-02-23 07:49:28 +08:00
endif ( )
endforeach ( )
2015-10-21 03:37:22 +08:00
endforeach ( )
#Special functions for CBLAS
if ( NOT DEFINED NO_CBLAS )
foreach ( float_type ${ FLOAT_TYPES } )
if ( ${ float_type } STREQUAL "COMPLEX" OR ${ float_type } STREQUAL "ZCOMPLEX" )
#cblas_dotc_sub cblas_dotu_sub
GenerateNamedObjects ( "zdot.c" "FORCE_USE_STACK" "dotu_sub" 1 "" "" false ${ float_type } )
GenerateNamedObjects ( "zdot.c" "FORCE_USE_STACK;CONJ" "dotc_sub" 1 "" "" false ${ float_type } )
endif ( )
endforeach ( )
endif ( )
2015-02-23 07:49:28 +08:00
2015-02-03 02:31:15 +08:00
if ( NOT DEFINED NO_LAPACK )
2015-02-05 01:30:15 +08:00
set ( LAPACK_SOURCES
2015-02-18 00:30:28 +08:00
l a p a c k / g e s v . c
)
# prepend z for complex versions
set ( LAPACK_MANGLED_SOURCES
2015-02-03 02:31:15 +08:00
l a p a c k / g e t r f . c l a p a c k / g e t r s . c l a p a c k / p o t r f . c l a p a c k / g e t f 2 . c
2015-02-18 00:30:28 +08:00
l a p a c k / p o t f 2 . c l a p a c k / l a s w p . c l a p a c k / l a u u 2 . c
2015-02-03 02:31:15 +08:00
l a p a c k / l a u u m . c l a p a c k / t r t i 2 . c l a p a c k / t r t r i . c
)
2015-02-18 00:30:28 +08:00
2015-02-16 07:44:37 +08:00
GenerateNamedObjects ( "${LAPACK_SOURCES}" )
2015-02-18 00:30:28 +08:00
GenerateNamedObjects ( "${LAPACK_MANGLED_SOURCES}" "" "" 0 "" "" 0 3 )
2015-02-03 02:31:15 +08:00
endif ( )
2015-02-25 02:26:33 +08:00
add_library ( interface OBJECT ${ OPENBLAS_SRC } )