sys-cluster/usort: new package, add 0_pre20211230

Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
This commit is contained in:
Alessandro Barbieri
2022-05-23 14:09:04 +02:00
parent 1ea3907755
commit 9c370ee3ec
5 changed files with 115 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST usort-0_pre20211230.tar.gz 36255 BLAKE2B 1137c96141c3bdd26cdddb650224ae276e88eac2f8190210ba9673030f7867f110411040ba4415821fef9b85f1af737f3e880ab15ded164fe3cd8135fcf9d725 SHA512 82474b33e0c74d6ce78a4e34bbbbb0e666646a708bbd56b298e3ae054c0c9682bfe6ea126f4f88c7047ad34eb1bc8aec6936f5cfb867dd5b3254052361b397ea

View File

@@ -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}")

View File

@@ -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 <typename T>
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)++;

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<name>Alessandro Barbieri</name>
<email>lssndrbarbieri@gmail.com</email>
</maintainer>
<upstream>
<bugs-to>https://github.com/hsundar/usort/issues</bugs-to>
<remote-id type="github">hsundar/usort</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -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
}