Code Monkey home page Code Monkey logo

Comments (17)

balewski avatar balewski commented on June 14, 2024 1

from amazon-braket-examples.

guomanmin avatar guomanmin commented on June 14, 2024

Looking into reproing this issue

from amazon-braket-examples.

guomanmin avatar guomanmin commented on June 14, 2024

Just running the hybrid_submit.py has been stucked at "Initializing Braket Job" for me so far. Still Investigating.

from amazon-braket-examples.

balewski avatar balewski commented on June 14, 2024

indeed, now it never passe the . . . ., this is what I see.
But at the time of filing this ticket the image would start after ~15 dots, then I'd get the crash.
FYI, I run my test when Aquila was up (just 10 hours per week) - perhaps image does not want to start if
deviceArn='arn:aws:braket:us-east-1::device/qpu/quera/Aquila' and Aquila is down?

Initializing Braket Job: arn:aws:braket:us-east-1:765483381942:job/braket-job-default-1689116339095
..........................................................................................................................................................................................................................................................................

from amazon-braket-examples.

speller26 avatar speller26 commented on June 14, 2024
  1. Which quera_ahs_utils module are you referring to? If you're talking about those that were introduced into the Braket SDK in amazon-braket/amazon-braket-sdk-python#508, the functions were moved to appropriate classes and renamed; for example, get_drive became DrivingField.from_lists.
  2. Would you be able to start a job locally, and in your script, print out the Braket SDK version (!pip show amazon-braket-sdk)? The AHS utils were introduced in 1.37.0, so it would help to see what version you're getting.

from amazon-braket-examples.

balewski avatar balewski commented on June 14, 2024

from amazon-braket-examples.

speller26 avatar speller26 commented on June 14, 2024

2.1) here are more details about it
$ pip3 list|grep amazon
amazon-braket-default-simulator 1.18.2
amazon-braket-schemas 1.18.0
amazon-braket-sdk 1.49.0
$pip3 list|grep ahs
quera-ahs-utils 0.4.3

I think this is your environment rather than the job environment; the library versions may be different between the two. As for the jobs themselves, the long initialization may be due to the job being stuck in a job queue; can you verify whether your job arn:aws:braket:us-east-1:765483381942:job/braket-job-default-1689116339095 has completed in the Braket console?

from amazon-braket-examples.

balewski avatar balewski commented on June 14, 2024

from amazon-braket-examples.

speller26 avatar speller26 commented on June 14, 2024

yes, this is my local environment. This is all what I can do now. As I mentioned ,I can't start a hybrid job for 5-10 minutes any more. I do not have patience to wait longer. This 1 time when the hybrid job started for me I could observe the stages: The initial .... stopped and then some image on AWS started, there was a message about it. Next the image accepted my QuEra python code and then I could see it submitted the Aquila job to QuEra, which I could observe via AWS web service as QUEUED. I could also kill this job via AWS web and then on my terminal I'd see the results form killed job returned by the image running on AWS. But I can't do it any more. The AWS image never reports as working. It is all in your court now. I can do nothing until you manage to start the AWS image. Can you start it?

In your code snippet, you have the line

wait_until_complete=True

which causes the ......... to appear and block your Python process. If you run

job = AwsQuantumJob.create(
    deviceArn,
    source_module="hybrid_task.py",
    entry_point="hybrid_task:start_here",
)

the job will still be created, and you can access its status with

job.state()

The wait is unfortunately out of our control; it depends on the number of customers who also have jobs queued up.

Do you see  as described https://docs.aws.amazon.com/braket/latest/developerguide/braket-jobs-first.html This message should show up even if my QuEra task is wrong - it reports the image has started Jan

I don't see the image you posted, but if it's a message output (like the Test job started!!!!! in your script) will not appear past the ...... while the job is in the QUEUED state.

image

from amazon-braket-examples.

speller26 avatar speller26 commented on June 14, 2024

To diagnose versioning issues, would you be able to run this script

import os
import numpy as np
from pprint import pprint
from decimal import Decimal

from braket import _schemas, _sdk, default_simulator
from braket.ahs import AtomArrangement, DrivingField, Hamiltonian, AnalogHamiltonianSimulation
from braket.devices import LocalSimulator
from braket.aws import AwsDevice
from braket.tracking import Tracker

#...!...!....................
def ahs_problem():
    a = 6.1e-6  # meters
    N_atoms = 11

    register = AtomArrangement()
    for i in range(N_atoms):   register.add([0.0, i*a])

    print('\nM:dump atom coordinates')
    
    xL=register.coordinate_list(0)
    yL=register.coordinate_list(1)
    
    for x,y in zip(xL,yL):  print(x,y)

    H = Hamiltonian()
    
    omega_max = 2e6 * 2 * np.pi
    detuning_min = -9e6 * 2 * np.pi
    detuning_max = 7e6 * 2 * np.pi
    
    time_max = Decimal('4')/1000000 # 4 us
    time_ramp =time_max/4

    # rounding is required for Aquila
    omega_max=int(omega_max/400)*400
    detuning_min=int(detuning_min*5)/5
    detuning_max=int(detuning_max*5)/5
    
    time_points = [0, time_ramp, time_max - time_ramp, time_max]
    omega_values = [0, omega_max, omega_max, 0]
    detuning_values = [detuning_min, detuning_min, detuning_max, detuning_max]
    phase_values = [0, 0, 0, 0]

    drive = DrivingField.from_lists(time_points, omega_values, detuning_values, phase_values)
    H += drive

    print('\nM:dump drive Amplitude :\n',drive.amplitude.time_series.times(), drive.amplitude.time_series.values())

    program = AnalogHamiltonianSimulation(  register=register, hamiltonian=H)

    return program

#...!...!....................
def full_task(device,ahs_prog,shots):
    task = device.run(ahs_prog, shots=shots)
    results=task.result()  # this forces wait for task completion/terminationcost tracking
    print('status=%s:'%task.state())
    
    if task.state()=='COMPLETED': 
        rawBitstr=results.get_counts()
        print('COMPLETED, rawBitstr:');  pprint(rawBitstr)
       
#...!...!....................
def start_here():    
    print("Test job started!!!!!")
    print("Versions:")  # See the versions of the Braket libraries in your image
    print(f"schemas: {_schemas.__version__}")
    print(f"SDK: {_sdk.__version__}")
    print(f"default simulator: {default_simulator.__version__}")
    # Use the device declared in the job script
    device = LocalSimulator("braket_ahs")
    print('M:device is braket_ahs')
    ahs_prog=ahs_problem()
    shots=100

    print("M:Test job completed!!!!!")

if __name__ == "__main__":
    start_here()

and run said script locally (assuming the same filename as your script):

from braket.jobs.local import LocalQuantumJob

job = LocalQuantumJob.create(
    device="local:amazon/braket_ahs,
    source_module="hybrid_task.py",
    entry_point="hybrid_task:start_here",
)

This will try to run your script on the local simulator, as well as print out the versions of the libraries in the container image.

from amazon-braket-examples.

balewski avatar balewski commented on June 14, 2024

from amazon-braket-examples.

balewski avatar balewski commented on June 14, 2024

from amazon-braket-examples.

balewski avatar balewski commented on June 14, 2024

Hi,
is there any resolution for this problem?
Thanks
Jan

from amazon-braket-examples.

speller26 avatar speller26 commented on June 14, 2024

Hi Jan,

We're very sorry for the delay in getting back to you. You should be able to run your script now, with modifications. First, there is no need to use quera_ahs_utils.drive.get_drive anymore; in fact, you can replace the import block

from braket.ahs.atom_arrangement import AtomArrangement
from braket.ahs.hamiltonian import Hamiltonian
from braket.ahs.analog_hamiltonian_simulation import AnalogHamiltonianSimulation
from quera_ahs_utils.drive import get_drive

with just

from braket.ahs import AnalogHamiltonianSimulation, AtomArrangement, DrivingField, Hamiltonian

and then replace

drive = get_drive(time_points, omega_values, detuning_values, phase_values)

with

drive = DrivingField.from_lists(time_points, omega_values, detuning_values, phase_values)

With these modifications, I can now run the job, and it gets to the

M:executing

print statement, which means that the DrivingField.from_lists is successful. Since from lists was introduced in the same change that added get_counts to AnalogHamiltonianSimulationQuantumTaskResult, this gives me some confidence that the rest of the job should run too.

I believe the issue was fixed with amazon-braket/amazon-braket-sdk-python#643, so pulling in the latest Amazon Braket SDK should do the trick.

As for the example I gave you, Docker is a requirement for running local jobs, so that might be the reason it didn't work.

from amazon-braket-examples.

balewski avatar balewski commented on June 14, 2024

from amazon-braket-examples.

speller26 avatar speller26 commented on June 14, 2024

There isn't a specific example of running a hybrid job with the QuEra Aquila (although a contribution is always welcome); as such, one path forward could be to adapt one of the QuEra example notebooks into a hybrid job. However, the easiest demonstration of success would be to run the script you provided to completion (with the modifications I listed); I'll run the job, and if it completes, then we're golden!

from amazon-braket-examples.

speller26 avatar speller26 commented on June 14, 2024

Thank you for catching this issue!

from amazon-braket-examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.