From 9c370ee3ec02c649fab72198d40a7ad0936f9745 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Mon, 23 May 2022 14:09:04 +0200 Subject: [PATCH] sys-cluster/usort: new package, add 0_pre20211230 Signed-off-by: Alessandro Barbieri --- sys-cluster/usort/Manifest | 1 + .../files/usort-0_pre20211230-cmake.patch | 34 +++++++++++++++++ ...usort-0_pre20211230-rename-THRESHOLD.patch | 31 ++++++++++++++++ sys-cluster/usort/metadata.xml | 12 ++++++ sys-cluster/usort/usort-0_pre20211230.ebuild | 37 +++++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 sys-cluster/usort/Manifest create mode 100644 sys-cluster/usort/files/usort-0_pre20211230-cmake.patch create mode 100644 sys-cluster/usort/files/usort-0_pre20211230-rename-THRESHOLD.patch create mode 100644 sys-cluster/usort/metadata.xml create mode 100644 sys-cluster/usort/usort-0_pre20211230.ebuild diff --git a/sys-cluster/usort/Manifest b/sys-cluster/usort/Manifest new file mode 100644 index 0000000000..71cc02443d --- /dev/null +++ b/sys-cluster/usort/Manifest @@ -0,0 +1 @@ +DIST usort-0_pre20211230.tar.gz 36255 BLAKE2B 1137c96141c3bdd26cdddb650224ae276e88eac2f8190210ba9673030f7867f110411040ba4415821fef9b85f1af737f3e880ab15ded164fe3cd8135fcf9d725 SHA512 82474b33e0c74d6ce78a4e34bbbbb0e666646a708bbd56b298e3ae054c0c9682bfe6ea126f4f88c7047ad34eb1bc8aec6936f5cfb867dd5b3254052361b397ea diff --git a/sys-cluster/usort/files/usort-0_pre20211230-cmake.patch b/sys-cluster/usort/files/usort-0_pre20211230-cmake.patch new file mode 100644 index 0000000000..616e15fd7a --- /dev/null +++ b/sys-cluster/usort/files/usort-0_pre20211230-cmake.patch @@ -0,0 +1,34 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -26,15 +26,25 @@ + + include_directories(include) + +-add_executable(usort src/main.cpp src/parUtils.cpp src/binUtils.cpp src/sort_profiler.cpp) +-target_link_libraries(usort ${MPI_LIBRARIES} m) ++add_library(Usortlib src/parUtils.cpp src/binUtils.cpp) ++target_include_directories(Usortlib PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") ++target_link_libraries(Usortlib ${MPI_LIBRARIES} m) ++ ++add_executable(usort src/main.cpp src/sort_profiler.cpp) ++target_include_directories(usort PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") ++target_link_libraries(usort ${MPI_LIBRARIES} m Usortlib) + + if(MPI_COMPILE_FLAGS) +- set_target_properties(usort PROPERTIES +- COMPILE_FLAGS "${MPI_COMPILE_FLAGS}") ++ set_target_properties(Usortlib PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}") ++ set_target_properties(usort PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}") + endif() + + if(MPI_LINK_FLAGS) +- set_target_properties(usort PROPERTIES +- LINK_FLAGS "${MPI_LINK_FLAGS}") ++ set_target_properties(Usortlib PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}") ++ set_target_properties(usort PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}") + endif() ++ ++include(GNUInstallDirs) ++install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/usort") ++install(TARGETS Usortlib LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") ++install(TARGETS usort LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/sys-cluster/usort/files/usort-0_pre20211230-rename-THRESHOLD.patch b/sys-cluster/usort/files/usort-0_pre20211230-rename-THRESHOLD.patch new file mode 100644 index 0000000000..6a0c5f901e --- /dev/null +++ b/sys-cluster/usort/files/usort-0_pre20211230-rename-THRESHOLD.patch @@ -0,0 +1,31 @@ +--- a/include/seqUtils.h ++++ b/include/seqUtils.h +@@ -30,7 +30,7 @@ + * The routine runs fastest with a uniform distribution of elements. + * The vector l is declare dynamically using the calloc function. + * The variable ctr counts the number of times that flashsort is called. +- * THRESHOLD is a very important constant. It is the minimum number of ++ * USORT_THRESHOLD is a very important constant. It is the minimum number of + * elements required in a subclass before recursion is used. + * + * Templated version of flashsort based on original C code by +--- a/include/seqUtils.tcc ++++ b/include/seqUtils.tcc +@@ -121,7 +121,7 @@ + template + void flashsort(T* a, int n, int m, int *ctr) + { +- const int THRESHOLD = 75; ++ const int USORT_THRESHOLD = 75; + const int CLASS_SIZE = 75; /* minimum value for m */ + + /* declare variables */ +@@ -192,7 +192,7 @@ + /**** Choice of RECURSION or STRAIGHT INSERTION *****/ + + for (k=0;k<(m-1);k++) +- if ( (nx = l[k+1]-l[k]) > THRESHOLD ) /* then use recursion */ ++ if ( (nx = l[k+1]-l[k]) > USORT_THRESHOLD ) /* then use recursion */ + { + flashsort(&a[l[k]+1],nx,CLASS_SIZE,ctr); + (*ctr)++; diff --git a/sys-cluster/usort/metadata.xml b/sys-cluster/usort/metadata.xml new file mode 100644 index 0000000000..aac99886af --- /dev/null +++ b/sys-cluster/usort/metadata.xml @@ -0,0 +1,12 @@ + + + + + Alessandro Barbieri + lssndrbarbieri@gmail.com + + + https://github.com/hsundar/usort/issues + hsundar/usort + + diff --git a/sys-cluster/usort/usort-0_pre20211230.ebuild b/sys-cluster/usort/usort-0_pre20211230.ebuild new file mode 100644 index 0000000000..c0c077b1d9 --- /dev/null +++ b/sys-cluster/usort/usort-0_pre20211230.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +COMMIT="902f5e3cbba66833bbf2d219c183d4705b3582c7" + +inherit cmake + +DESCRIPTION='Fast distributed sorting routines using MPI and OpenMP' +HOMEPAGE="https://github.com/hsundar/usort" +SRC_URI="https://github.com/hsundar/${PN}/archive/${COMMIT}.tar.gz -> ${PF}.tar.gz" +S="${WORKDIR}/${PN}-${COMMIT}" + +KEYWORDS="~amd64" +LICENSE='MIT' +IUSE="" +SLOT="0" + +DEPEND="virtual/mpi" +RDEPEND="${DEPEND}" +BDEPEND="app-text/dos2unix" + +PATCHES=( + "${FILESDIR}/${P}-cmake.patch" + "${FILESDIR}/${P}-rename-THRESHOLD.patch" +) + +src_prepare() { + dos2unix CMakeLists.txt || die + cmake_src_prepare +} + +src_install() { + cmake_src_install + dodoc README.md +}