quil-lang / qvm

The high-performance and featureful Quil simulator.
Other
411 stars 57 forks source link

Building DQVM #256

Open mlxd opened 4 years ago

mlxd commented 4 years ago

Hi, I am looking at building the DQVM, but the Readme.md (https://github.com/rigetti/qvm/blob/master/dqvm/README.md) seems to reference a Makefile that was deleted sometime in the past.

I am wondering if there are some updated instructions to build this? Thank you in advance!

notmgsk commented 4 years ago

@mlxd I haven't verified this, but it might be the case that the Makefile was replaced by the script in dqvm/scripts/build-dqvm2-sbcl. Give that a shot.

notmgsk commented 4 years ago

Yeah that looks to be the case: https://github.com/rigetti/qvm/blob/bump-version-1.17.1/dqvm/Makefile

mlxd commented 4 years ago

@notmgsk Thanks for the info. My Common Lisp isn't really up to scratch, but I needed to make two edits to that script to get things building:

  1. Loading Quicklisp (we use non-standard installation directory for this) by adding --load <QUICKLISP_HOME>/quicklisp/setup.lisp
  2. Remove :compression t from the final eval line, as the issue seemed the same as here https://github.com/rigetti/quilc/issues/161 as we use a conda provided sbcl environment.

The above script succeeded, but it failed to load the DQVM when attempting to use the provided run script with a sample quil file (I assume I will need to make some edits here, but will need to revisit in a day or two).

I wonder if there is any help needed to generalise this script similar as the builds of qvm and qvm-ng? Would a Makefile be a better fit, as variables can be overridden by the user without editing the file, and any generated objects can also be tracked and recompiled as necessary?

If none of this would be helpful, no problem, and I can keep plugging away to find a structure that works for me. Thanks again for any feedback.

mlxd commented 4 years ago

Just a quick update, I have made a few changes to put the appropriate paths into the run script: ./dqvm2-sbcl --load $QUICKLISP_HOME/setup.lisp --eval "(push \"$PWD/\" ql:*local-project-directories*)" --eval '(asdf:load-system :dqvm2)' --eval '(quit)' and am now reaching the following error: The variable MPI::+MPI-DOUBLE-COMPLEX+ is unbound.

This seems to be also found here, which is either the same or at least similar: http://report.quicklisp.org/2020-04-28/failure-report/qvm.html#dqvm2

Again, I appreciate any feedback that can be given.

notmgsk commented 4 years ago

Ah! Congrats on getting that far 😃

A colleague was working on improving the CL MPI bindings. Though that particular PR seems to have stalled.

Are you familiar with how to install your own CL libraries?

mlxd commented 4 years ago

Thanks! 👍

Not familiar, but I can take another look at this in a few days (and at that PR) and see if I can work through it.

notmgsk commented 4 years ago

Here's a few steps to follow:

  1. Clone the aforementioned PR into somewhere like /home/you/code/lisp/cl-mpi and then checkout the appropriate branch.
  2. In your ~/.sbclrc config file, add something like
    #+quicklisp
    (progn
    (setf quicklisp-client:*quickload-verbose* t)
    (push "/home/you/code/lisp/"
        ql:*local-project-directories*))
  3. Open up sbcl and start with (ql:register-local-projects), and then try (ql:quickload :cl-mpi).

If 3. doesn't work out, make sure that quicklisp is finding your cl-mpi with

  1. (asdf:locate-system :cl-mpi) -- hopefully this should show the correct path /home/you/code/lisp/cl-mpi.asd.
  2. If not, you might need to go nuclear and blow any caches away. In your qvm folder, try make cleanall. Then go back to 3.

I was able to get dqvm2 loading after doing the above. Let me know how you get along.