git: f1fc728ac56d - main - math/openblas64: new port, OpenBLAS with 8 byte integers
Date: Sat, 08 Jun 2024 18:41:59 UTC
The branch main has been updated by thierry: URL: https://cgit.FreeBSD.org/ports/commit/?id=f1fc728ac56d8ec25ed39e211b08f257dbf46756 commit f1fc728ac56d8ec25ed39e211b08f257dbf46756 Author: Thierry Thomas <thierry@FreeBSD.org> AuthorDate: 2024-06-08 17:43:51 +0000 Commit: Thierry Thomas <thierry@FreeBSD.org> CommitDate: 2024-06-08 18:41:55 +0000 math/openblas64: new port, OpenBLAS with 8 byte integers Remark 1: CMake support is experimental. It does not yet support all build options, but the 64 bits libraries can be installed without conflict with the classic version. Remark 2: some tests fail on -CURRENT "SIGSEGV: Segmentation fault - invalid memory reference.". It seems caused by clang-18 and threads. --- math/Makefile | 1 + math/openblas64/Makefile | 112 ++++++------------------- math/openblas64/distinfo | 6 +- math/openblas64/files/patch-CMakeLists.txt | 11 +++ math/openblas64/files/patch-cmake_system.cmake | 38 +++++++++ math/openblas64/files/patch-exports_Makefile | 4 +- math/openblas64/pkg-descr | 4 +- math/openblas64/pkg-plist | 35 ++++---- 8 files changed, 98 insertions(+), 113 deletions(-) diff --git a/math/Makefile b/math/Makefile index ebf3004b2fb2..128639ea786a 100644 --- a/math/Makefile +++ b/math/Makefile @@ -668,6 +668,7 @@ SUBDIR += onednn SUBDIR += onednn252 SUBDIR += openblas + SUBDIR += openblas64 SUBDIR += openfst SUBDIR += openfst-vosk SUBDIR += openlibm diff --git a/math/openblas64/Makefile b/math/openblas64/Makefile index cf23f359fa20..2925783a01a2 100644 --- a/math/openblas64/Makefile +++ b/math/openblas64/Makefile @@ -1,82 +1,65 @@ PORTNAME= openblas DISTVERSIONPREFIX= v -DISTVERSION= 0.3.25 -PORTEPOCH= 2 +DISTVERSION= 0.3.27 CATEGORIES= math MASTER_SITES= NL/lapack/timing/:lapack_tmg +PKGNAMESUFFIX= 64 DISTFILES= large.tgz:lapack_tmg \ timing.tgz:lapack_tmg DIST_SUBDIR= openblas -MAINTAINER= phd_kimberlite@yahoo.co.jp -COMMENT= Optimized BLAS library based on GotoBLAS2 +MAINTAINER= thierry@FreeBSD.org +COMMENT= OpenBLAS with 8 byte integers on 64-bits architectures WWW= https://github.com/OpenMathLib/OpenBLAS LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE -USES= compiler:c11 cpe fortran gmake perl5 pkgconfig +NOT_FOR_ARCHS= armv6 armv7 i386 powerpc +NOT_FOR_ARCHS_REASON= Only for 64-bits architectures + +USES= cmake:testing compiler:c11 cpe fortran gmake pathfix pkgconfig +CMAKE_ARGS= -DINTERFACE64:BOOL=on \ + -DSUFFIX64_UNDERSCORE:STRING=64 \ + -DSYMBOLSUFFIX:STRING=_64 \ + -DBUILD_SHARED_LIBS:BOOL=on \ + -DBUILD_STATIC_LIBS:BOOL=on \ + -DUSE_THREAD:BOOL=on USE_GITHUB= yes GH_ACCOUNT= OpenMathLib GH_PROJECT= OpenBLAS -GH_TAGNAME= 5e1a429 LARGE_FILE= large.tgz TIMING_FILE= timing.tgz CPE_VENDOR= openblas_project USE_LDCONFIG= yes -USE_PERL5= build - -OPENBLAS_SVER= 0 -TEST_TARGET= tests PLIST_SUB+= PORTVERSION=${PORTVERSION} -OPTIONS_DEFINE= DYNAMIC_ARCH INTERFACE64 OPENMP +OPTIONS_DEFINE= BENCHMARKS DYNAMIC_ARCH OPENMP OPTIONS_DEFAULT= OPENMP -OPTIONS_DEFINE_i386= AVX AVX2 -OPTIONS_DEFINE_amd64= AVX AVX2 -OPTIONS_EXCLUDE_armv6= OPENMP -OPTIONS_EXCLUDE_armv7= OPENMP OPTIONS_EXCLUDE_powerpc64le= OPENMP OPTIONS_EXCLUDE_powerpc64= OPENMP -OPTIONS_EXCLUDE_powerpc= OPENMP -OPTIONS_RADIO= ${OPTIONS_RADIO_${ARCH}} -OPTIONS_RADIO_powerpc64= POWER -OPTIONS_RADIO_POWER= POWER6 POWER8 OPTIONS_SUB= yes .if defined(BATCH) || defined(PACKAGE_BUILDING) -OPTIONS_DEFAULT_i386= DYNAMIC_ARCH OPTIONS_DEFAULT_amd64= DYNAMIC_ARCH OPTIONS_DEFAULT_powerpc64le= DYNAMIC_ARCH .endif +BENCHMARKS_DESC= Build the collection of BLAS/LAPACK benchmarks DYNAMIC_ARCH_DESC= Optimize for multiple CPU types, otherwise for this CPU -INTERFACE64_DESC= Use 8 byte integers on 64-bit architectures -OPENMP_DESC= Use OpenMP for threading -AVX_DESC= Support Advanced Vector Extensions (AVX) -AVX2_DESC= Support Advanced Vector Extensions 2 (AVX2) -POWER6_DESC= Optimize for POWER6, instead of the default PPC970 -POWER8_DESC= Optimize for POWER8, instead of the default PPC970 + +BENCHMARKS_CMAKE_BOOL= BUILD_BENCHMARKS +DYNAMIC_ARCH_CMAKE_BOOL=DYNAMIC_ARCH DYNAMIC_OLDER +OPENMP_CMAKE_BOOL= USE_OPENMP +OPENMP_LDFLAGS= -lomp .include <bsd.port.options.mk> .if ${ARCH} == powerpc64 USE_GCC= yes -. if ${PORT_OPTIONS:MPOWER6} -TARGET_CPU_ARCH= POWER6 -. elif ${PORT_OPTIONS:MPOWER8} -TARGET_CPU_ARCH= POWER8 -.else -TARGET_CPU_ARCH= PPC970 -. endif -.endif - -.if ${ARCH} == powerpc -USE_GCC= yes -TARGET_CPU_ARCH= PPCG4 .endif .if ${ARCH} == powerpc64le @@ -84,60 +67,13 @@ CFLAGS+= -lm USE_GCC= yes .endif -MAXTHREADS?= 64 - -.include <bsd.port.pre.mk> - post-extract: cd ${DISTDIR}/${DIST_SUBDIR} ; \ ${CP} ${LARGE_FILE} ${TIMING_FILE} ${WRKSRC} -post-patch: - @${ECHO_CMD} MAKE_NB_JOBS=-1 >> ${WRKSRC}/Makefile.rule - @${ECHO_CMD} NUM_THREADS=${MAXTHREADS} >> ${WRKSRC}/Makefile.rule - @${ECHO_CMD} USE_THREAD=1 >> ${WRKSRC}/Makefile.rule -.if ! ${PORT_OPTIONS:MAVX} - @${ECHO_CMD} NO_AVX=1 >> ${WRKSRC}/Makefile.rule -.endif -.if ! ${PORT_OPTIONS:MAVX2} - @${ECHO_CMD} NO_AVX2=1 >> ${WRKSRC}/Makefile.rule -.endif -.if ${PORT_OPTIONS:MDYNAMIC_ARCH} - @${ECHO_CMD} DYNAMIC_ARCH=1 >> ${WRKSRC}/Makefile.rule - @${ECHO_CMD} DYNAMIC_OLDER=1 >> ${WRKSRC}/Makefile.rule -.endif -.if defined(TARGET_CPU_ARCH) - @${ECHO_CMD} TARGET=${TARGET_CPU_ARCH} >> ${WRKSRC}/Makefile.rule -.endif -.if ${PORT_OPTIONS:MINTERFACE64} - @${ECHO_CMD} INTERFACE64=1 >> ${WRKSRC}/Makefile.rule -.endif -.if ${PORT_OPTIONS:MOPENMP} - @${ECHO_CMD} USE_OPENMP=1 >> ${WRKSRC}/Makefile.rule -.endif -.if ${ARCH:M*64*} == "" - @${ECHO_CMD} BINARY=32 >> ${WRKSRC}/Makefile.rule -.else - @${ECHO_CMD} BINARY=64 >> ${WRKSRC}/Makefile.rule -.endif - -post-patch-OPENMP-on: - @${REINPLACE_CMD} -e "s+OPENBLAS_NUM_THREADS+OMP_NUM_THREADS+g" \ +pre-configure-OPENMP-on: + ${REINPLACE_CMD} -e "s+OPENBLAS_NUM_THREADS+OMP_NUM_THREADS+g" \ ${WRKSRC}/test/Makefile \ ${WRKSRC}/ctest/Makefile -BENCHMARK_MAXTHREADS?= ${MAXTHREADS} -.if ${PORT_OPTIONS:MOPENMP} -BENCHMARK_THREADS_FLAG= OMP_NUM_THREADS=${BENCHMARK_MAXTHREADS} -.else -BENCHMARK_THREADS_FLAG= OPENBLAS_NUM_THREADS=${BENCHMARK_MAXTHREADS} -.endif - -benchmark: build - cd ${WRKSRC} ; ${SETENV} ${MAKE_CMD} ${MAKE_ARGS} hpl - cd ${WRKSRC}/benchmark ; ${SETENV} ${BENCHMARK_THREADS_FLAG} ${MAKE_CMD} ${MAKE_ARGS} - -post-install-DYNAMIC_ARCH-off: - cd ${STAGEDIR}${PREFIX} && ls lib/libopenblas_*p-r${PORTVERSION}.* >> ${TMPPLIST} - -.include <bsd.port.post.mk> +.include <bsd.port.mk> diff --git a/math/openblas64/distinfo b/math/openblas64/distinfo index 883c98157110..169879c569a1 100644 --- a/math/openblas64/distinfo +++ b/math/openblas64/distinfo @@ -1,7 +1,7 @@ -TIMESTAMP = 1699873046 +TIMESTAMP = 1717789737 SHA256 (openblas/large.tgz) = f328d88b7fa97722f271d7d0cfea1c220e0f8e5ed5ff01d8ef1eb51d6f4243a1 SIZE (openblas/large.tgz) = 2595 SHA256 (openblas/timing.tgz) = 999c65f8ea8bd4eac7f1c7f3463d4946917afd20a997807300fe35d70122f3af SIZE (openblas/timing.tgz) = 1059485 -SHA256 (openblas/OpenMathLib-OpenBLAS-v0.3.25-5e1a429_GH0.tar.gz) = 848beec6974e550aef74784b599a1c88549f70432b575e1dc1822eef15b4bc5d -SIZE (openblas/OpenMathLib-OpenBLAS-v0.3.25-5e1a429_GH0.tar.gz) = 24073895 +SHA256 (openblas/OpenMathLib-OpenBLAS-v0.3.27_GH0.tar.gz) = aa2d68b1564fe2b13bc292672608e9cdeeeb6dc34995512e65c3b10f4599e897 +SIZE (openblas/OpenMathLib-OpenBLAS-v0.3.27_GH0.tar.gz) = 24493704 diff --git a/math/openblas64/files/patch-CMakeLists.txt b/math/openblas64/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..a58aa620cb0b --- /dev/null +++ b/math/openblas64/files/patch-CMakeLists.txt @@ -0,0 +1,11 @@ +--- CMakeLists.txt.orig 2024-04-04 20:26:04 UTC ++++ CMakeLists.txt +@@ -448,7 +448,7 @@ if (BUILD_SHARED_LIBS AND NOT ${SYMBOLPREFIX}${SYMBOLS + if (NOT USE_PERL) + add_custom_command(TARGET ${OpenBLAS_LIBNAME}_shared POST_BUILD + COMMAND ${PROJECT_SOURCE_DIR}/exports/gensymbol "objcopy" "${ARCH}" "${BU}" "${EXPRECISION_IN}" "${NO_CBLAS_IN}" "${NO_LAPACK_IN}" "${NO_LAPACKE_IN}" "${NEED2UNDERSCORES_IN}" "${ONLY_CBLAS_IN}" \"${SYMBOLPREFIX}\" \"${SYMBOLSUFFIX}\" "${BLD}" "${BBF16}" "${BS}" "${BD}" "${BC}" "${BZ}" > ${PROJECT_BINARY_DIR}/objcopy.def +- COMMAND objcopy -v --redefine-syms ${PROJECT_BINARY_DIR}/objcopy.def ${PROJECT_BINARY_DIR}/lib/lib${OpenBLAS_LIBNAME}.so ++ COMMAND objcopy --redefine-syms ${PROJECT_BINARY_DIR}/objcopy.def ${PROJECT_BINARY_DIR}/lib/lib${OpenBLAS_LIBNAME}.so + COMMENT "renaming symbols" + ) + else() diff --git a/math/openblas64/files/patch-cmake_system.cmake b/math/openblas64/files/patch-cmake_system.cmake new file mode 100644 index 000000000000..7611527d4fa1 --- /dev/null +++ b/math/openblas64/files/patch-cmake_system.cmake @@ -0,0 +1,38 @@ +--- cmake/system.cmake.orig 2024-04-04 20:26:04 UTC ++++ cmake/system.cmake +@@ -172,7 +172,7 @@ if (DEFINED TARGET) + endif() + elseif (${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang") + if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 8.99) +- set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=cooperlake -exhaustive-register-search") ++ set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=cooperlake -mllvm -exhaustive-register-search") + else() + set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=skylake-avx512 -exhaustive-register-search") + endif() +@@ -188,7 +188,7 @@ if (DEFINED TARGET) + endif() + elseif (${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang") + if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 12.0) +- set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=sapphirerapids -exhaustive-register-search") ++ set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=sapphirerapids -mllvm -exhaustive-register-search") + else() + set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=skylake-avx512 -exhaustive-register-search") + endif() +@@ -197,7 +197,7 @@ if (DEFINED TARGET) + if (${TARGET} STREQUAL SKYLAKEX AND NOT NO_AVX512) + set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=skylake-avx512") + if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang") +- set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -exhaustive-register-search") ++ set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mllvm -exhaustive-register-search") + endif() + endif() + +@@ -215,7 +215,7 @@ if (DEFINED TARGET) + else() + set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=skylake-avx512") + endif() +- set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -exhaustive-register-search") ++ set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mllvm -exhaustive-register-search") + endif() + endif() + diff --git a/math/openblas64/files/patch-exports_Makefile b/math/openblas64/files/patch-exports_Makefile index 7e7692de9ce0..25a09c700fe6 100644 --- a/math/openblas64/files/patch-exports_Makefile +++ b/math/openblas64/files/patch-exports_Makefile @@ -1,6 +1,6 @@ ---- exports/Makefile.orig 2023-04-01 20:18:01 UTC +--- exports/Makefile.orig 2024-04-04 20:26:04 UTC +++ exports/Makefile -@@ -222,7 +222,7 @@ else +@@ -234,7 +234,7 @@ endif endif $(CC) $(CFLAGS) $(LDFLAGS) -shared -o ../$(LIBSONAME) \ -Wl,--whole-archive $< -Wl,--no-whole-archive \ diff --git a/math/openblas64/pkg-descr b/math/openblas64/pkg-descr index 55a88a92404a..ed1029e1c978 100644 --- a/math/openblas64/pkg-descr +++ b/math/openblas64/pkg-descr @@ -2,6 +2,4 @@ OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. OpenBLAS is an open source project supported by Lab of Parallel Software and Computational Science, ISCAS. -NOTE: If you want to specify your CPU microarchitecture manually, -please use TARGET_CPU_ARCH knob, e.g., "make TARGET_CPU_ARCH=NEHALEM". -This value is set TARGET build flag. +This version uses 8 byte integers on 64-bits architectures. diff --git a/math/openblas64/pkg-plist b/math/openblas64/pkg-plist index 66ad1a092738..ebf29b43d220 100644 --- a/math/openblas64/pkg-plist +++ b/math/openblas64/pkg-plist @@ -1,17 +1,18 @@ -include/cblas.h -include/f77blas.h -include/lapack.h -include/lapacke.h -include/lapacke_config.h -include/lapacke_mangling.h -include/lapacke_utils.h -include/openblas_config.h -lib/cmake/openblas/OpenBLASConfig.cmake -lib/cmake/openblas/OpenBLASConfigVersion.cmake -lib/libopenblas.a -lib/libopenblas.so -lib/libopenblas.so.0 -%%DYNAMIC_ARCH%%lib/libopenblasp-r%%PORTVERSION%%.a -%%DYNAMIC_ARCH%%lib/libopenblasp-r%%PORTVERSION%%.so -%%NO_INTERFACE64%%libdata/pkgconfig/openblas.pc -%%INTERFACE64%%libdata/pkgconfig/openblas64.pc +include/openblas64/cblas.h +include/openblas64/f77blas.h +include/openblas64/lapack.h +include/openblas64/lapacke.h +include/openblas64/lapacke_config.h +include/openblas64/lapacke_example_aux.h +include/openblas64/lapacke_mangling.h +include/openblas64/lapacke_utils.h +include/openblas64/openblas_config.h +lib/cmake/OpenBLAS64/OpenBLAS64Config.cmake +lib/cmake/OpenBLAS64/OpenBLAS64ConfigVersion.cmake +lib/cmake/OpenBLAS64/OpenBLAS64Targets-%%CMAKE_BUILD_TYPE%%.cmake +lib/cmake/OpenBLAS64/OpenBLAS64Targets.cmake +lib/libopenblas_64.a +lib/libopenblas_64.so +lib/libopenblas_64.so.0 +lib/libopenblas_64.so.0.3 +libdata/pkgconfig/openblas64.pc