jpmorganchase / QOKit

QOKit
https://www.jpmorgan.com/technology/applied-research
Apache License 2.0
52 stars 23 forks source link

pip install fails to build c simulator #41

Open ZichangHe opened 9 months ago

ZichangHe commented 9 months ago

Running pip install . fails to build c simulator on OmniQ. As an additional fix, Github actions should check that c simulator is built correctly

rsln-s commented 9 months ago

As an additional fix, Github actions should check that c simulator is built correctly

Specifically, we should have two tests that are triggered in GitHub Actions:

  1. Check that the simulator is one of the available ones:
    from qokit.fur import get_available_simulator_names
    assert 'c' in get_available_simulator_names('x')
    assert 'c' in get_available_simulator_names('xyring')
    assert 'c' in get_available_simulator_names('xycomplete')
  2. Check that the objective evaluation is fast (please note that below is pseudocode):
    
    import dumpy as np
    from qokit import get_qaoa_labs_objective

theta = np.random.uniform(0,1,280) f = get_qaoa_labs_objective(20, 140)

timer start

f(theta)

timer end

assert time_elapsed < 5 # seconds



Make sure that these tests are decorated properly to be only run in Github actions
ZichangHe commented 9 months ago

@alex124585, may I ask if there's been any progress on this?

alex124585 commented 8 months ago

As an additional fix, Github actions should check that c simulator is built correctly

Specifically, we should have two tests that are triggered in GitHub Actions:

  1. Check that the simulator is one of the available ones:
from qokit.fur import get_available_simulator_names
assert 'c' in get_available_simulator_names('x')
assert 'c' in get_available_simulator_names('xyring')
assert 'c' in get_available_simulator_names('xycomplete')
  1. Check that the objective evaluation is fast (please note that below is pseudocode):
import dumpy as np
from qokit import get_qaoa_labs_objective

theta = np.random.uniform(0,1,280)
f = get_qaoa_labs_objective(20, 140)
# timer start
f(theta)
# timer end
assert time_elapsed < 5 # seconds

Make sure that these tests are decorated properly to be only run in Github actions

I believe import dumpy as np should be import numpy as np

alex124585 commented 8 months ago

after run pip install . in omniq I am getting >>> get_available_simulator_names() ['c', 'python']

rsln-s commented 8 months ago

Huh! Can you please add the test to confirm this is also the case in GitHub actions?

rsln-s commented 5 months ago

I just did an install in a clean OmniQ instance and the simulator was not built correctly. Reopening this issue.

git clone https://github.com/jpmorganchase/QOKit.git
cd QOKit/
pip install -e .
from qokit.fur import get_available_simulator_names
print(get_available_simulator_names("x"))

gives ['gpu', 'python']