Skip to content

Commit

Permalink
remove dependence on lapack
Browse files Browse the repository at this point in the history
  • Loading branch information
stylewarning committed Aug 9, 2022
1 parent 99e3275 commit 6c3cd1f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ system-index.txt: $(QUICKLISP_SETUP)
install-test-deps:
ifeq ($(UNAME_S),Linux)
ifeq ($(shell sed -n "s/^ID=//p" /etc/os-release),debian)
apt-get update && apt-get install -y git libblas-dev libffi-dev liblapack-dev libzmq3-dev
apt-get update && apt-get install -y git libzmq3-dev
else ifeq ($(shell sed -n "s/^ID=//p" /etc/os-release),ubuntu)
apt update && apt install -y git libblas-dev libffi-dev liblapack-dev libzmq3-dev
apt update && apt install -y git libzmq3-dev
else
echo "Centos-based platforms unsupported"
endif
Expand Down
4 changes: 0 additions & 4 deletions app/src/entry-point.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@
#+sbcl
(format t "Loaded libraries:~%~{ ~A~%~}~%"
(mapcar 'sb-alien::shared-object-pathname sb-sys:*shared-objects*))
(unless (magicl.foreign-libraries:foreign-symbol-available-p "zuncsd_"
'magicl.foreign-libraries:liblapack)
(format t "The loaded version of LAPACK is missing necessary functionality.~%")
(quit-nicely 1))
(format t "Library check passed.~%")
(quit-nicely 0))

Expand Down
21 changes: 12 additions & 9 deletions app/src/mangle-shared-objects.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
;;;;
;;;; This is loaded (as with CL:LOAD) before the final image is saved.
;;;;
;;;; Rewrites shared library references to libblas.dylib and
;;;; liblapack.dylib on Mac SDK targets to use the Rigetti package
;;;; path /usr/local/lib/rigetti. This is so the exact
;;;; Rigetti-provided versions of these libraries are found when the
;;;; SDK binary starts up. If these were not rewritten, the SDK binary
;;;; could try to load from non-existent Brew paths or inadequate
;;;; Accelerate-related system paths.
;;;; This file rewrites shared library references on Mac SDK targets
;;;; to use the Rigetti package path /usr/local/lib/rigetti. This is
;;;; so the exact Rigetti-provided versions of these libraries are
;;;; found when the SDK binary starts up. If these were not rewritten,
;;;; the SDK binary could try to load from non-existent Brew paths or
;;;; inadequate system paths.
;;;;
;;;; This file used to rewrite libblas.dylib and liblapack.dylib.
;;;;
;;;; Has no effect on non-Mac targets.

(in-package #:cl-user)

(defvar *dylibs-to-replace* '()
"A list of dylib filenames (with extensions) that need replacement.")

(dolist (shared-object sb-sys:*shared-objects*)
(let ((dylibs-to-replace '("libblas.dylib"
"liblapack.dylib"))
(let ((dylibs-to-replace *dylibs-to-replace*)
(original-path (sb-alien::shared-object-pathname shared-object)))
(let ((dylib (first (member (file-namestring original-path)
dylibs-to-replace
Expand Down
7 changes: 3 additions & 4 deletions qvm.asd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
(values))

(asdf:defsystem #:qvm
:description "An implementation of the Quantum Abstract Machine."
:author "Robert Smith <[email protected]>"
:description "An implementation of the Quantum/Quil Abstract Machine."
:author "Robert Smith, Rigetti Computing, and Quil-Lang Contributors"
:license "Apache License 2.0 (See LICENSE.txt)"
:version (:read-file-form "VERSION.txt")
:defsystem-depends-on (#:cffi-grovel)
Expand All @@ -24,7 +24,6 @@
#:lparallel
;; Matrix algebra
(:version #:magicl/core "0.9.0")
#:magicl/ext-lapack
;; weak hash tables
#:trivial-garbage
;; static globals
Expand All @@ -40,7 +39,7 @@
;; Portable random number generator
#:mt19937
;; For allocation info.
#+sbcl #:sb-introspect
(:feature :sbcl #:sb-introspect)
;; Portable *features*
#:trivial-features)
:in-order-to ((asdf:test-op (asdf:test-op #:qvm-tests)))
Expand Down

0 comments on commit 6c3cd1f

Please sign in to comment.