git: 73bbe7b7f081 - main - biology/gkl: New port: Accelerated kernel library for genomics

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 04 Aug 2024 20:09:45 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=73bbe7b7f0814a152a169c859ed208cee8a13152

commit 73bbe7b7f0814a152a169c859ed208cee8a13152
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-08-04 19:07:41 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-08-04 20:09:41 +0000

    biology/gkl: New port: Accelerated kernel library for genomics
---
 biology/Makefile                                   |  1 +
 biology/gkl/Makefile                               | 26 +++++++++++++++++
 biology/gkl/distinfo                               |  3 ++
 biology/gkl/files/patch-CMakeLists.txt             | 11 ++++++++
 ...atch-src_main_native_compression_CMakeLists.txt | 33 ++++++++++++++++++++++
 .../patch-src_main_native_pairhmm_CMakeLists.txt   | 18 ++++++++++++
 .../patch-src_main_native_pairhmm_IntelPairHmm.cc  | 12 ++++++++
 .../patch-src_main_native_pdhmm_CMakeLists.txt     |  8 ++++++
 .../gkl/files/patch-src_main_native_pdhmm_pdhmm.h  | 12 ++++++++
 ...ch-src_main_native_smithwaterman_CMakeLists.txt |  9 ++++++
 .../patch-src_main_native_utils_CMakeLists.txt     |  8 ++++++
 .../gkl/files/patch-src_main_native_utils_utils.cc | 13 +++++++++
 biology/gkl/pkg-descr                              | 19 +++++++++++++
 biology/gkl/pkg-plist                              |  6 ++++
 14 files changed, 179 insertions(+)

diff --git a/biology/Makefile b/biology/Makefile
index faa2b7ac520f..2415e6d7a85c 100644
--- a/biology/Makefile
+++ b/biology/Makefile
@@ -72,6 +72,7 @@
     SUBDIR += generand
     SUBDIR += gff2ps
     SUBDIR += gffread
+    SUBDIR += gkl
     SUBDIR += gmap
     SUBDIR += gperiodic
     SUBDIR += graphlan
diff --git a/biology/gkl/Makefile b/biology/gkl/Makefile
new file mode 100644
index 000000000000..84b614afb7d1
--- /dev/null
+++ b/biology/gkl/Makefile
@@ -0,0 +1,26 @@
+PORTNAME=	gkl
+DISTVERSION=	0.8.11-9
+DISTVERSIONSUFFIX=	-g25670d8
+CATEGORIES=	biology devel
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Accelerated kernel library for genomics
+WWW=		https://github.com/Intel-HLS/GKL
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	gmake:devel/gmake
+LIB_DEPENDS=	libisal.so:devel/isa-l
+
+USES=		cmake:noninja localbase:ldflags
+USE_JAVA=	yes
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	Intel-HLS
+GH_PROJECT=	GKL
+
+BINARY_ALIAS=	make=${GMAKE}
+
+.include <bsd.port.mk>
diff --git a/biology/gkl/distinfo b/biology/gkl/distinfo
new file mode 100644
index 000000000000..35c01c063547
--- /dev/null
+++ b/biology/gkl/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1722788727
+SHA256 (Intel-HLS-GKL-0.8.11-9-g25670d8_GH0.tar.gz) = 743d1eb48c2629454a6dcb98d9adca3aaedfe9c658e6f89e890b03b6e029df61
+SIZE (Intel-HLS-GKL-0.8.11-9-g25670d8_GH0.tar.gz) = 5310668
diff --git a/biology/gkl/files/patch-CMakeLists.txt b/biology/gkl/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..2cda423767df
--- /dev/null
+++ b/biology/gkl/files/patch-CMakeLists.txt
@@ -0,0 +1,11 @@
+--- CMakeLists.txt.orig	2024-08-04 17:44:32 UTC
++++ CMakeLists.txt
+@@ -24,6 +24,8 @@ set(NATIVE_DIR ${PROJECT_SOURCE_DIR}/src/main/native)
+ # add CMakeLists.txt in subdirectories
+ set(NATIVE_DIR ${PROJECT_SOURCE_DIR}/src/main/native)
+ 
++link_directories(${CMAKE_INSTALL_PREFIX}/lib)
++
+ add_subdirectory("${NATIVE_DIR}/compression")
+ add_subdirectory("${NATIVE_DIR}/pairhmm")
+ add_subdirectory("${NATIVE_DIR}/utils")
diff --git a/biology/gkl/files/patch-src_main_native_compression_CMakeLists.txt b/biology/gkl/files/patch-src_main_native_compression_CMakeLists.txt
new file mode 100644
index 000000000000..e0c47e762f4a
--- /dev/null
+++ b/biology/gkl/files/patch-src_main_native_compression_CMakeLists.txt
@@ -0,0 +1,33 @@
+--- src/main/native/compression/CMakeLists.txt.orig	2024-07-04 12:14:50 UTC
++++ src/main/native/compression/CMakeLists.txt
+@@ -30,21 +30,7 @@ endif()
+ endif()
+ 
+ 
+-ExternalProject_Add(
+-   isalExternal
+-   URL ${CMAKE_CURRENT_SOURCE_DIR}/isa-l-master
+-   UPDATE_COMMAND <SOURCE_DIR>/autogen.sh
+-   CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --with-pic=yes ${CONFIG_OPT}
+-   BUILD_COMMAND $(MAKE)
+-   INSTALL_COMMAND $(MAKE) install
+-)
+ 
+-add_library(isal STATIC IMPORTED GLOBAL)
+-set_target_properties(isal PROPERTIES IMPORTED_LOCATION
+-  ${CMAKE_CURRENT_BINARY_DIR}/isalExternal-prefix/lib/libisal.a
+-)
+-
+-
+ #---------------------------------------------------------------------
+ # gkl_compression
+ #---------------------------------------------------------------------
+@@ -56,6 +42,6 @@ add_library(${TARGET} SHARED 
+   IntelDeflater.cc
+   IntelInflater.cc
+   )
+-add_dependencies(${TARGET} isalExternal otc_zlibExternal)
++add_dependencies(${TARGET} otc_zlibExternal)
+ target_link_libraries(${TARGET} zlibstatic isal)
+-install(TARGETS ${TARGET} DESTINATION ${CMAKE_BINARY_DIR})
++install(TARGETS ${TARGET} DESTINATION lib)
diff --git a/biology/gkl/files/patch-src_main_native_pairhmm_CMakeLists.txt b/biology/gkl/files/patch-src_main_native_pairhmm_CMakeLists.txt
new file mode 100644
index 000000000000..d87b85bd35de
--- /dev/null
+++ b/biology/gkl/files/patch-src_main_native_pairhmm_CMakeLists.txt
@@ -0,0 +1,18 @@
+--- src/main/native/pairhmm/CMakeLists.txt.orig	2024-08-04 17:57:13 UTC
++++ src/main/native/pairhmm/CMakeLists.txt
+@@ -17,7 +17,7 @@ add_library(${TARGET} SHARED IntelPairHmm.cc avx_impl.
+ #---------------------------------------------------------------------
+ set(TARGET gkl_pairhmm)
+ add_library(${TARGET} SHARED IntelPairHmm.cc avx_impl.cc avx512_impl.cc pairhmm_common.cc)
+-install(TARGETS ${TARGET} DESTINATION ${CMAKE_BINARY_DIR})
++install(TARGETS ${TARGET} DESTINATION lib)
+ 
+ #---------------------------------------------------------------------
+ # pairhmm_omp
+@@ -29,5 +29,5 @@ if(OPENMP_FOUND)
+   add_library(${TARGET} SHARED IntelPairHmm.cc avx_impl.cc avx512_impl.cc pairhmm_common.cc)
+   set_target_properties(${TARGET} PROPERTIES COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
+   target_link_libraries(${TARGET} ${OpenMP_CXX_FLAGS})
+-  install(TARGETS ${TARGET} DESTINATION ${CMAKE_BINARY_DIR})
++  install(TARGETS ${TARGET} DESTINATION lib)
+ endif()
diff --git a/biology/gkl/files/patch-src_main_native_pairhmm_IntelPairHmm.cc b/biology/gkl/files/patch-src_main_native_pairhmm_IntelPairHmm.cc
new file mode 100644
index 000000000000..6118936feab4
--- /dev/null
+++ b/biology/gkl/files/patch-src_main_native_pairhmm_IntelPairHmm.cc
@@ -0,0 +1,12 @@
+--- src/main/native/pairhmm/IntelPairHmm.cc.orig	2024-08-04 16:29:20 UTC
++++ src/main/native/pairhmm/IntelPairHmm.cc
+@@ -24,6 +24,9 @@
+ #ifdef linux
+ #include <omp.h>
+ #endif
++#ifdef __FreeBSD__
++#include <omp.h>
++#endif
+ #include <vector>
+ #include <math.h>
+ #include <debug.h>
diff --git a/biology/gkl/files/patch-src_main_native_pdhmm_CMakeLists.txt b/biology/gkl/files/patch-src_main_native_pdhmm_CMakeLists.txt
new file mode 100644
index 000000000000..949d35b19b4d
--- /dev/null
+++ b/biology/gkl/files/patch-src_main_native_pdhmm_CMakeLists.txt
@@ -0,0 +1,8 @@
+--- src/main/native/pdhmm/CMakeLists.txt.orig	2024-08-04 17:58:05 UTC
++++ src/main/native/pdhmm/CMakeLists.txt
+@@ -23,4 +23,4 @@ endif()
+   set_target_properties(${TARGET} PROPERTIES COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
+   target_link_libraries(${TARGET} ${OpenMP_CXX_FLAGS})
+ endif()
+-install(TARGETS ${TARGET} DESTINATION ${CMAKE_BINARY_DIR})
++install(TARGETS ${TARGET} DESTINATION lib)
diff --git a/biology/gkl/files/patch-src_main_native_pdhmm_pdhmm.h b/biology/gkl/files/patch-src_main_native_pdhmm_pdhmm.h
new file mode 100644
index 000000000000..4896be46607f
--- /dev/null
+++ b/biology/gkl/files/patch-src_main_native_pdhmm_pdhmm.h
@@ -0,0 +1,12 @@
+--- src/main/native/pdhmm/pdhmm.h.orig	2024-08-04 16:31:53 UTC
++++ src/main/native/pdhmm/pdhmm.h
+@@ -27,6 +27,9 @@
+ #ifdef linux
+ #include <omp.h>
+ #endif
++#ifdef __FreeBSD__
++#include <omp.h>
++#endif
+ 
+ inline INT_TYPE roundDownToNearestMultipleOf(INT_TYPE val, INT_TYPE mul) { return (val / mul) * mul; }
+ 
diff --git a/biology/gkl/files/patch-src_main_native_smithwaterman_CMakeLists.txt b/biology/gkl/files/patch-src_main_native_smithwaterman_CMakeLists.txt
new file mode 100644
index 000000000000..994e254eacf7
--- /dev/null
+++ b/biology/gkl/files/patch-src_main_native_smithwaterman_CMakeLists.txt
@@ -0,0 +1,9 @@
+--- src/main/native/smithwaterman/CMakeLists.txt.orig	2024-08-04 17:53:57 UTC
++++ src/main/native/smithwaterman/CMakeLists.txt
+@@ -23,5 +23,5 @@ add_library(${TARGET} SHARED
+ add_library(${TARGET} SHARED
+     IntelSmithWaterman.cc avx2_impl.cc avx512_impl.cc smithwaterman_common.cc)
+ 
+-install(TARGETS ${TARGET} DESTINATION ${CMAKE_BINARY_DIR})
++install(TARGETS ${TARGET} DESTINATION lib)
+ 
diff --git a/biology/gkl/files/patch-src_main_native_utils_CMakeLists.txt b/biology/gkl/files/patch-src_main_native_utils_CMakeLists.txt
new file mode 100644
index 000000000000..b209b75c8a2f
--- /dev/null
+++ b/biology/gkl/files/patch-src_main_native_utils_CMakeLists.txt
@@ -0,0 +1,8 @@
+--- src/main/native/utils/CMakeLists.txt.orig	2024-08-04 17:47:07 UTC
++++ src/main/native/utils/CMakeLists.txt
+@@ -11,4 +11,4 @@ endif()
+   set_target_properties(${TARGET} PROPERTIES COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
+   target_link_libraries(${TARGET} ${OpenMP_CXX_FLAGS})
+ endif()
+-install(TARGETS ${TARGET} DESTINATION ${CMAKE_BINARY_DIR})
++install(TARGETS ${TARGET} DESTINATION lib)
diff --git a/biology/gkl/files/patch-src_main_native_utils_utils.cc b/biology/gkl/files/patch-src_main_native_utils_utils.cc
new file mode 100644
index 000000000000..c4828fc021d5
--- /dev/null
+++ b/biology/gkl/files/patch-src_main_native_utils_utils.cc
@@ -0,0 +1,13 @@
+--- src/main/native/utils/utils.cc.orig	2024-08-04 16:26:45 UTC
++++ src/main/native/utils/utils.cc
+@@ -31,6 +31,10 @@
+   #include <omp.h>
+ #endif
+ 
++#ifdef __FreeBSD__
++  #include <omp.h>
++#endif
++
+ #include "utils.h"
+ #include <avx.h>
+ 
diff --git a/biology/gkl/pkg-descr b/biology/gkl/pkg-descr
new file mode 100644
index 000000000000..b41d2ffd742c
--- /dev/null
+++ b/biology/gkl/pkg-descr
@@ -0,0 +1,19 @@
+GKL is a set of optimized versions of compute kernels used in genomics
+applications like GATK and HTSJDK.
+
+Kernels included:
+* PairHMM
+     AVX and AVX-512 optimized versions of PairHMM used in GATK
+     HaplotypeCaller and MuTect2.
+     OpenMP support for multicore processors.
+* Smith-Waterman
+     AVX2 and AVX-512 optimized versions of Smith-Waterman used in GATK
+     HaplotypeCaller and MuTect2.
+* DEFLATE Compression/Decompression:
+     Performance optimized Level 1 and 2 compression and decompression
+     from Intel's ISA-L library.
+     Performance optimized Level 3 through 9 compression from Intel's
+     Open Source Technology Center zlib library.
+* Partially Determined HMM (PDHMM)
+     AVX2 and AVX-512 optimized versions of PDHMM used in GATK.
+     Serial Implementation for CPU's with no AVX.
diff --git a/biology/gkl/pkg-plist b/biology/gkl/pkg-plist
new file mode 100644
index 000000000000..00c0b14b46a9
--- /dev/null
+++ b/biology/gkl/pkg-plist
@@ -0,0 +1,6 @@
+lib/libgkl_compression.so
+lib/libgkl_pairhmm.so
+lib/libgkl_pairhmm_omp.so
+lib/libgkl_pdhmm.so
+lib/libgkl_smithwaterman.so
+lib/libgkl_utils.so