I want to run my custom designed encryption algorithm on parallel GPUs and for that reason I am using qiskit-aer-gpu. Currently I am simulating on a single machine. The GPU I am utilizing for the purpose is GeForce GTX 1080 Ti which has 11G memory which is the only extra memory I get when I enabled GPU. My machine has 15G of memory itself.

The variables of my algo which I can change in order to make it complex or simplify is

  1. operations used for encryption (XOR, Left Rotation, Right Rotation)
  2. Message length
  3. Key length

Now varying these values, I sometime able to run my algo (less length of message or key or less no of operations) and sometimes it generates error of having not enough RAM to simulate successfully (more message length or more operations). My question is which fails this simulation? Is it only depending upon extra RAM GPU is providing? Does it use any extra processing power of GPU? Is no of qubits got increase and this cannot be satisfied by simulator?

The error Message I get

Simulation failed and returned the following error message:
ERROR:  [Experiment 0] Insufficient memory to run circuit circuit-121 using the matrix_product_state simulator. Required memory: 31232M, max memory: 15837M (Host) + 11175M (GPU)

Here is my algo

message = """"TesttesttesttesttesttestTesttesttesttesttesttestTesttesttesttesttesttest"""
key = "12345"
ROT = True


mes = bytes(message, 'utf-8').hex()
key = bytes(key, 'utf-8').hex()

mes_l = len(mes)
key_l = len(key)

num_chunks = math.ceil(mes_l / key_l)

chunks = [mes[key_l * i:key_l * (i + 1)]
        for i in range(num_chunks)]

for i in range(len(chunks)):

b = QuantumRegister(4*key_l)

qc = QuantumCircuit(b)

for i in range(len(chunks)):

for i in range(len(chunks)):
    Round_constant_XOR(qc,int(chunks[i],16),a[i],4*len(chunks[i])) # For copying input

Round_constant_XOR(qc,int(key,16),b,4*key_l) # For copying key

res_enc =  Encryption(qc,a,b,res_enc,ROT,chunks) # Three op of XOR, LROT and RROT

for i in range(len(chunks)):
    output[i] = Measure_state(qc,res_enc[i],output[i], 4*len(chunks[i])) 

simulator_gpu = Aer.get_backend('aer_simulator_matrix_product_state')

print("no of qubits support")

job_sim = execute(qc, simulator_gpu)
result_sim = job_sim.result()
counts = result_sim.get_counts(qc)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.