From nobody Sat Jan 15 10:32:19 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CF437194C9B3; Sat, 15 Jan 2022 10:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JbZH81wTpz3jFd; Sat, 15 Jan 2022 10:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642242740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TP7PGGUWccHsIm0knmD6rpGYb7FVO+26OE0AlPX04M0=; b=CxANnHyh+M0fPFib1O3Veej00p3YtcVzjUAmksx6Ob3+OW6NmMxTH59bNuhg2cEVSVGYQw xtJpexwKg3zjaKpNYAnzu+p5mnzGLFFls8zhfdyz5avDIoDnIbHKEtMzKDal3zpmrvGq5e FOk3PiDMyCd4Ml2J1hWzPDrJ+JbTpSgX6K+sqdeRAHGQ+kXSr5efzjNlvOLR/dHl+i7EuO gHIJ5ySpDNhKQ1z66prb63ibq7ZlwnyhqY+CXT7D+MkoZCGpcsoaNPjme7gr08YLGN6V0Q l1naHZqSpjWc+FG/8RMIHWsV6ExCUVmGksCptvZJdWQHmzdxYcr2OYncWJEZVQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AED925971; Sat, 15 Jan 2022 10:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20FAWJuJ005118; Sat, 15 Jan 2022 10:32:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20FAWJqn005117; Sat, 15 Jan 2022 10:32:19 GMT (envelope-from git) Date: Sat, 15 Jan 2022 10:32:19 GMT Message-Id: <202201151032.20FAWJqn005117@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Yuri Victorovich Subject: git: 01c541ffecc4 - main - math/py-faiss: New port: Library for efficient similarity search & clustering of dense vectors List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuri X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01c541ffecc47b79f4a1ec161645cad3138c8e37 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642242740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TP7PGGUWccHsIm0knmD6rpGYb7FVO+26OE0AlPX04M0=; b=tylOfLe3QRJj3JSVX5P2YcWl1aqrRDWTryivsrMmpOVhbtSz1xvyE8wqMSrKKntyPkjYxB OjUl2qWip+PJIDRTh/9p8Y4Cz3HmOrV3QUGZTMSx78xgBqskMuI0mRn1/gAZX/a4kWU5S+ Sm/6dig8G0Bvt4aHkbInTtzh26hVKw6f8/XikezjaAJm8AP0pwKZMhBzzM08ME3nQqz2SZ VK5FPjqi0VqtfRYIEvYy9WWl5rMKgInfq5iBKn79yppXj1SITY9HlQwOlbTszHFdPd/Yrm 4rGlzPWtdAe8eT+JAeYGz7KcdODDQiVkzVnS61YC48KlBl4ouSnO8VnrtS79Vg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642242740; a=rsa-sha256; cv=none; b=eR1GWtFim1QShm4Rds/rLXGD7HiPVoRdUXk7HE69Yrw725cCOwYF/hDrZgfIjqTqchV3I0 edusytjGEsIbBCYBJm/HYpdROILdHJg+T+KN5aWsP10RAw0HizzhBHheuxySF5Cj75tlEq StBVvyMZUcbwYKEOXu8Z9YaRedZoLamuo6HL3UnabbYtv1VlbdbKZ27kdnQs1dlYBBh5OA S/WzTFIkZjMBQpcj4/mkxBrO1ky7XqQaB+j9a3lDtDdGgoyMR3Sk9cD+B3KGTsuX5V1pmJ KTDRKOyvNEIsXTibrZaJ/TypAvwH+C0UMxkfBDFsEjRpn6ff2v+0eDpYmLNpUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=01c541ffecc47b79f4a1ec161645cad3138c8e37 commit 01c541ffecc47b79f4a1ec161645cad3138c8e37 Author: Yuri Victorovich AuthorDate: 2022-01-15 10:31:21 +0000 Commit: Yuri Victorovich CommitDate: 2022-01-15 10:32:16 +0000 math/py-faiss: New port: Library for efficient similarity search & clustering of dense vectors --- math/Makefile | 1 + math/py-faiss/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ math/py-faiss/distinfo | 3 +++ math/py-faiss/files/test.py | 16 ++++++++++++++++ math/py-faiss/pkg-descr | 8 ++++++++ 5 files changed, 70 insertions(+) diff --git a/math/Makefile b/math/Makefile index b7abeb8381c9..e9a903e9519d 100644 --- a/math/Makefile +++ b/math/Makefile @@ -827,6 +827,7 @@ SUBDIR += py-deap SUBDIR += py-ducc0 SUBDIR += py-ecos + SUBDIR += py-faiss SUBDIR += py-fastcluster SUBDIR += py-fastdtw SUBDIR += py-flax diff --git a/math/py-faiss/Makefile b/math/py-faiss/Makefile new file mode 100644 index 000000000000..ef4d64d0daef --- /dev/null +++ b/math/py-faiss/Makefile @@ -0,0 +1,42 @@ +PORTNAME= faiss +DISTVERSIONPREFIX= v +DISTVERSION= 1.7.2 +CATEGORIES= math +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Library for efficient similarity search & clustering of dense vectors + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/../../LICENSE + +PY_DEPENDS= ${PYNUMPY} +BUILD_DEPENDS= swig:devel/swig \ + ${PY_DEPENDS} +LIB_DEPENDS= libfaiss.so:math/faiss +RUN_DEPENDS= ${PY_DEPENDS} + +USES= cmake compiler:c++11-lang localbase python + +USE_GITHUB= yes +GH_ACCOUNT= facebookresearch + +WRKSRC_SUBDIR= faiss/python + +PLIST_FILES= \ + ${PYTHON_SITELIBDIR}/${PORTNAME}/_swigfaiss.so \ + ${PYTHON_SITELIBDIR}/${PORTNAME}/__init__.py \ + ${PYTHON_SITELIBDIR}/${PORTNAME}/loader.py \ + ${PYTHON_SITELIBDIR}/${PORTNAME}/swigfaiss.py + +do-install: # see https://github.com/facebookresearch/faiss/issues/2194 + ${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME} + ${INSTALL_LIB} ${BUILD_WRKSRC}/_swigfaiss.so ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME} +.for f in __init__.py loader.py swigfaiss.py + ${INSTALL_DATA} ${BUILD_WRKSRC}/${f} ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME} +.endfor + +do-test: install + @${PYTHON_CMD} ${FILESDIR}/test.py + +.include diff --git a/math/py-faiss/distinfo b/math/py-faiss/distinfo new file mode 100644 index 000000000000..692e7da7cd70 --- /dev/null +++ b/math/py-faiss/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1642235176 +SHA256 (facebookresearch-faiss-v1.7.2_GH0.tar.gz) = d49b4afd6a7a5b64f260a236ee9b2efb760edb08c33d5ea5610c2f078a5995ec +SIZE (facebookresearch-faiss-v1.7.2_GH0.tar.gz) = 740431 diff --git a/math/py-faiss/files/test.py b/math/py-faiss/files/test.py new file mode 100644 index 000000000000..f1395cf46a3e --- /dev/null +++ b/math/py-faiss/files/test.py @@ -0,0 +1,16 @@ +import numpy as np +d = 64 # dimension +nb = 100000 # database size +nq = 10000 # nb of queries +np.random.seed(1234) # make reproducible +xb = np.random.random((nb, d)).astype('float32') +xb[:, 0] += np.arange(nb) / 1000. +xq = np.random.random((nq, d)).astype('float32') +xq[:, 0] += np.arange(nq) / 1000. + + +import faiss # make faiss available +index = faiss.IndexFlatL2(d) # build the index +print(index.is_trained) +index.add(xb) # add vectors to the index +print(index.ntotal) diff --git a/math/py-faiss/pkg-descr b/math/py-faiss/pkg-descr new file mode 100644 index 000000000000..a482a49936a3 --- /dev/null +++ b/math/py-faiss/pkg-descr @@ -0,0 +1,8 @@ +Python binding for Faiss. + +Faiss is a library for efficient similarity search and clustering of dense +vectors. It contains algorithms that search in sets of vectors of any size, +up to ones that possibly do not fit in RAM. It also contains supporting code +for evaluation and parameter tuning. + +WWW: https://github.com/facebookresearch/faiss