diff options
author | William PC <w_calandrini[at]hotmail[dot]com> | 2022-11-12 10:48:01 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2022-11-12 10:48:01 +0700 |
commit | 3f50fb224559923f9336365a90dc640e7155eff6 (patch) | |
tree | 543cfa7d841241f2100824bb081d61ddfa45cb67 /academic | |
parent | d1374385265acd842d437503b5a47dd8dd13bb85 (diff) | |
download | slackbuilds-3f50fb224559923f9336365a90dc640e7155eff6.tar.gz |
academic/minorminer: Added (heuristic tool for minor embedding).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'academic')
-rw-r--r-- | academic/minorminer/README | 12 | ||||
-rw-r--r-- | academic/minorminer/minorminer.SlackBuild | 140 | ||||
-rw-r--r-- | academic/minorminer/minorminer.info | 10 | ||||
-rw-r--r-- | academic/minorminer/slack-desc | 19 |
4 files changed, 181 insertions, 0 deletions
diff --git a/academic/minorminer/README b/academic/minorminer/README new file mode 100644 index 0000000000..c1d4ef7222 --- /dev/null +++ b/academic/minorminer/README @@ -0,0 +1,12 @@ + minorminer is a heuristic tool for minor embedding: given a minor +and target graph, it tries to find a mapping that embeds the minor +into the target. + minorminer is a tool for finding graph minors, developed to embed +Ising problems onto quantum annealers (QA). Where it can be used to +find minors in arbitrary graphs, it is particularly geared towards +the state of the art in QA: problem graphs of a few to a few hundred +variables, and hardware graphs of a few thousand qubits. + + + Optional building mode set with environment variables: + - TESTS=yes (performs tests, requires gtest) diff --git a/academic/minorminer/minorminer.SlackBuild b/academic/minorminer/minorminer.SlackBuild new file mode 100644 index 0000000000..caa9a029d1 --- /dev/null +++ b/academic/minorminer/minorminer.SlackBuild @@ -0,0 +1,140 @@ +#!/bin/bash + +# Slackware build script for minorminer + +# Copyright 2022 William PC - Seattle, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM="minorminer" +VERSION=${VERSION:-0.2.9} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + + +# fix util.hpp +sed -i '19a#include <memory>' include/find_embedding/util.hpp + +# fix examples and tests CMakeLists.txt +sed -i '11s/ minorminer//' examples/CMakeLists.txt +sed -i '11s/ minorminer//' tests/CMakeLists.txt + +python3 setup.py install --root=$PKG + +if [ "${TESTS:-no}" == "yes" ]; then + cd tests + cmake \ + -DCMAKE_CXX_FLAGS="-I../include" . + make + ./run_tests + cd .. +fi + +# run tests (requires homebase, networkx and several other pkgs) +#for file in $(ls test_*.py); do +# PYTHONPATH=../build/lib.linux-x86_64-3.9 \ +# python3 -c "print ('$file'); exec(open('$file').read())" ; +#done + +# install includes +install -d $PKG/usr/include/minorminer +cp -av include/* $PKG/usr/include/minorminer + +# install examples +mkdir -p $PKG/usr/share/$PRGNAM-$VERSION +cp -a examples $PKG/usr/share/$PRGNAM-$VERSION + +# fix example +sed -i 's#\(../include\)/\(find_embedding\).hpp#/usr/include/minorminer/\2/\2.hpp#' $PKG/usr/share/$PRGNAM-$VERSION/examples/example.cpp + + +# Don't ship .la files: +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + LICENSE README.rst docs \ + $PKG/usr/doc/$PRGNAM-$VERSION +# fix broken symlink and copy real file +rm $PKG/usr/doc/$PRGNAM-$VERSION/docs/source/parameter_checklist.txt +cp -av parameter_checklist.txt $PKG/usr/doc/$PRGNAM-$VERSION/docs/source/ + +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/academic/minorminer/minorminer.info b/academic/minorminer/minorminer.info new file mode 100644 index 0000000000..a9ea741a1e --- /dev/null +++ b/academic/minorminer/minorminer.info @@ -0,0 +1,10 @@ +PRGNAM="minorminer" +VERSION="0.2.9" +HOMEPAGE="https://github.com/dwavesystems/minorminer" +DOWNLOAD="https://github.com/dwavesystems/minorminer/archive/0.2.9/minorminer-0.2.9.tar.gz" +MD5SUM="de59a2d16a94ee5853938cbf19d61a6f" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="William PC" +EMAIL="w_calandrini[at]hotmail[dot]com" diff --git a/academic/minorminer/slack-desc b/academic/minorminer/slack-desc new file mode 100644 index 0000000000..125054455f --- /dev/null +++ b/academic/minorminer/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +minorminer: minorminer (heuristic tool for minor embedding) +minorminer: +minorminer: +minorminer: +minorminer: minorminer is a heuristic tool for minor embedding: given a minor +minorminer: and target graph, it tries to find a mapping that embeds the minor +minorminer: into the target. +minorminer: +minorminer: +minorminer: +minorminer: |