Put on your Avengers Quantum suit and let's spin some atoms !!
Edited Royalty free stock photos

Put on your Avengers Quantum suit and let's spin some atoms !!

Atos publicly released its Quantum Learning Machine simulator and like many colleagues, I did my bit by announcing on my Linkedin, after all its a proud moment for us and especially me where I have a deep curiosity about quantum realm, its spookiness, and the fact that we absolutely don't know anything about how it works. I made a note on my desk to try it sometime, its publicly available so why not,?fast forward a few weeks from that point till a Friday evening, and am looking forward to the weekend, just as I was ready to sign off I see a sticky pad peeking at me that read "Try myQLM", with the new inspiration I jumped on the website and clicked install to soon realize how hands off I may have gotten, until a couple of years ago I used to love to code for fun, but this appeared alien to me, Quantum programming was nothing like I have ever experienced... 30 minutes into it and I was ready to walk away, just when I saw this neat little link on our website that pulled me right back by offering me a ready to use cloud test environment.

To be upfront, Math was never my favorite subject and from what I can gather, the current iteration of Quantum programming concepts appears to be math-heavy, there is a reasonable amount of literature available but if you are like me after reading the first few lines you will move on. With the amazing toolkit and tutorials at Atos myQLM I can probably say now that I know a little bit about Quantum Computing and more specifically about Qbits, Circuits, a couple of gates, simulator, backend, result, visualization, interoperability and also got acquainted to other popular quantum SDKs like Qiskit and OpenQASM and a few more that I have trouble spelling, the real ah-ha moment was when I was able to execute this very simple program on Atos Quantum Simulator and also on actual Quantum Machine at IBM (yes a real Quantum computer).

For starters, this "Hello World" is not the foo bar Hello World's we see, this is rather a very elementary quantum manipulation using python and the Atos myQLM and Qiskit. Let's understand the key items that I think are closest to traditional programming.

If you get confused reading the below, don't worry and read it as a general reference, the actual code is relatively easy.

Qbit - Quantum bit is a quantum version of our classical binary bits with a big difference that a traditional bit can exist either as 0 or 1 while a Qbit can be both (don't ask why please, even Einstein didn't know this spookiness), a Qbit is the fundamental unit in quantum computation. Best to think of them as Atoms, protons etc.

Circuit - similar to physical circuits where routines and data can be stored, a Circuit is a mechanism where various computational routines and quantum data can be compartmentalized.

Gates - these are quantum logical operators that operate on Qbits, I believe I can naively compare them to the AND, OR logical gates in traditional computing platforms however Quantum gates are quite complex, I barely understood the "H" (Hadamard) gate and the CNOT gate. H gates does a 90-degree rotation to a state of the Qbit and the CNOT gates can perform entanglement or disentanglement.

Let's look at the code now using the Atos myQLM, in this hello world, we will create a program, qbits, circuit, gates and execute it on Atos myQLM simulator.

#import required libs 
from qat.lang.AQASM import Program, H, CNOT
from qat.qpus import get_default_qpu

# Create a program
qprog = Program()
# Allocate 2 qbits
qbits = qprog.qalloc(2)
# Add a H Gate
H(qbits[0])
# entagle using CNOT
CNOT(qbits[0], qbits[1])
# Create a circuit
circuit = qprog.to_circ()
# Create a job
job = circuit.to_job() # parameters"nbshots=0" replace 0 with number of times you want the simulation to run

# Instantiate a QPU (simulator)
qpu = get_default_qpu()

# Execute
result = qpu.submit(job)
for sample in result:
? ? print("State %s: probability %s" % (sample.state, sample.probability))        

The above code will run on the cloud test environment and once executed it will spit out a state of the entangled Qbits.

You can run a similar program on an actual IBM Quantum computer (free to create an account and use) and there are few ways to do this and I didn't find them difficult

  1. Atos myQLM interoperates with Qiskit SDK that allows pushing this job to IBM Quantum experience.
  2. Run Qiskit standalone and execute on IBM Quantum computer.
  3. Code the above (using either QISKIT or QASM SDK ) directly on IBM Quantum console.

At the time of writing this, I am can write code in Atos myQLM to interop with IBM Quantum computer, a simpler version of this code can be found here and clicking tutorials->interoperability->interoperations->Qiskit connect to IBM Backend.

My myQLM to IBM Quantum Interop code looks like this.

from qat.interop.qiskit import BackendToQPU


# Declare your IBM token
MY_IBM_TOKEN = "YOUR IBM TOKEN, ITS FREE AND EASY TO GET GOOGLE IT"

# Wrap a Qiskit backend in a QPU, IBMQ Manila is one of the many options
qpu = BackendToQPU(token=MY_IBM_TOKEN, ibmq_backend="ibmq_manila")

# Submit a job to IBMQ
result = qpu.submit(job)

# Execute
result = qpu.submit(job)        

That's pretty much it, took me all about 6 hours to figure all this out. If you are curious what the results are, they are just the states of the Qbits represented as the number and to be honest I will have a hard time explaining it, try it and find out for yourself.

So, as I sign off from my brief yet exciting experience coding on Atos myQLM and on IBM Quantum computer, I take comfort in knowing that I started learning something new, reinforced my confidence that I still got this and in the process had the pleasure of spinning a few atoms and electrons.
Amit S.

I help architect your database and data architecture. I love automating your database related operations. Specialise in Oracle and PostgreSQL

3 年

Very well written Manish. Simple and clear. Enjoyed reading it. Will chat about it offline sometime.

Amitava Paul

Sr Manager Healthcare IT - Medicaid | Product-Program Management

3 年

Very nicely articulated, You have surely raised my interest to learn more about the topic ??

Suresh Behera

Software Developer Expert | Entrepreneurs | AI Enthusiast | Investor

3 年

Nice intro , love it.

要查看或添加评论,请登录

Manish Mehta的更多文章

  • GenAI - The Cost of Context.

    GenAI - The Cost of Context.

    As I write this article, OpenAI released their latest model GPT 4 Turbo today - its OpenAI's most powerful AI yet…

    1 条评论
  • Retro Rational: Making Wise Choices in a High-Tech World

    Retro Rational: Making Wise Choices in a High-Tech World

    As a digital transformation evangelist, I've seen firsthand the incredible value that emerging technologies can bring…

    6 条评论
  • AI Whisperers: The Rise of the Prompt Engineer

    AI Whisperers: The Rise of the Prompt Engineer

    You've probably heard about the incredible power of Generative AI and how it may disrupt various industries. It's also…

    7 条评论
  • Cloud Assembly Language - The Ultimate Low-Code Manifest.

    Cloud Assembly Language - The Ultimate Low-Code Manifest.

    My programming career started with Beginners All Purpose Symbolic Instruction Code (BASIC) and rapidly progressed to…

    5 条评论
  • Who's your preferred Healthcare Hyperscaler?

    Who's your preferred Healthcare Hyperscaler?

    Technology consulting is an interesting career, many times you get the privilege to engage with clients and other…

    1 条评论
  • You got a mask, did your data?

    You got a mask, did your data?

    COVID 19 has brought down upon us an unprecedented number of unknowns and a stark realization on how as a world we…

    6 条评论
  • To Virtualize or to Containerize – That is the question.

    To Virtualize or to Containerize – That is the question.

    Among all the things shaping the Software technology landscape, one item that is gaining rapid momentum is the world of…

    1 条评论
  • For Newbs only - What I learnt from my investment in Crypto Currency

    For Newbs only - What I learnt from my investment in Crypto Currency

    The views and comments expressed in this article are solely mine and is not intended to lead or offend or solicit or…

    10 条评论
  • Blockchain – Duh!!

    Blockchain – Duh!!

    Among all the new and emerging trends in the industry, BlockChain is probably the one that is surrounded by enigma on…

    16 条评论
  • Am I a Full Stack Developer?

    Am I a Full Stack Developer?

    If you are a Full stack developer, you know it already, read on just for fun or to bully me with your comments. This…

    8 条评论

社区洞察

其他会员也浏览了