Ask coding questions

← Back to all posts
Question About Repl.it Memory Capabilities
AmazingMech2418 (1039)

So, I'm working on making a quantum computer simulator in Node.js and I got this error when trying to run a 16-qubit program:

Is there a way to expand the repl's memory capabilities or is this simply too heavy of an operation for Repl.it to handle?

Comments
hotnewtop
xxpertHacker (865)

Show what you're doing to #amasad, tell him it's the first quantum computer on Repl.it. Explain why you deserve a free hacker plan. After that, post it on /share and get the "content creator" badge too.

I dare you

AmazingMech2418 (1039)

@xxpertHacker LOL! Okay. I can ping him right here... @amasad The comment I'm referring to is right above this by the way.

fuzzyastrocat (1513)

@xxpertHacker If Quil runs on replit (which it does) then it's not the first quantum computer simulator...

xxpertHacker (865)

@fuzzyastrocat You know what? I forgot about Quil.
But in that case, as I have in fact seen it on Repl, as it is a language formally hosted on Repl at /languages, you are correct, it is not the first.

AmazingMech2418 (1039)

@fuzzyastrocat I'm the only one to make a Quil post though... Also, Quil is made by Rigetti Computing. LOL!

fuzzyastrocat (1513)

@AmazingMech2418 Quil runs on repl.it though. (I don't mean that repl.it created it, I just mean that it's on repl.it).

xxpertHacker (865)

@AmazingMech2418 Is there a Quil language tutorial anywhere?

AmazingMech2418 (1039)

@fuzzyastrocat Yeah, but it's not made by someone on Repl.it...

AmazingMech2418 (1039)

@xxpertHacker Yeah. I made it. LOL! Part 2 is coming soon!

xxpertHacker (865)

@AmazingMech2418
a) Link it
b) I meant, is there a tutorial/guide/docs provided by Rigetti?

fuzzyastrocat (1513)

Given how heavy of a demand this is, I'm guessing it's just a Repl limit. Hacker plan might get you more memory, I can't confirm however.

As xxpertHacker has suggested, I'd move it to something like C where you can be really meticulous about memory usage.

AmazingMech2418 (1039)

@fuzzyastrocat The only thing though is that that would probably give me 11 qubits, but not 16. LOL! The storage grows exponentially with the number of qubits...

fuzzyastrocat (1513)

@AmazingMech2418 Yeah, but C takes quite a bit less memory than node so you might be able to eek out a good out amount.

AmazingMech2418 (1039)

@fuzzyastrocat Yeah. Though even open a Quil repl and try doing H 18 and it's so slow. LOL! It's better than 10, but still shows that there still are limitations...

MicroSoftHelp (60)

@AmazingMech2418 u want the good stuff

hacker plan

xxpertHacker (865)

That's probably a Node.js memory problem, not a Repl problem, and I think you can pass CLI arguments to increase the heap size.

Maybe a less-memory intensive language would work better?

If you really need it to work in Node, there is a C++ FFI for Node.js.

Or, maybe it's just the way that you had structured your code?

AmazingMech2418 (1039)

@xxpertHacker I'm planning on converting to C++ after this. I'm just using Node.js to get a basic working program. Though, I'm kind of worried about the lack of garbage collection in C++ too...

xxpertHacker (865)

@AmazingMech2418 C++ has garbage collection in the stdlib, wdym? Also, just statically allocating memory is usually better.

AmazingMech2418 (1039)

@xxpertHacker Well, it's not automatic... Like you have to use free and that doesn't work if you're trying to manipulate strings in a given scope... And with this, that is really important. LOL!

xxpertHacker (865)

@AmazingMech2418 I'm sorry, there must have been a miscommunication somewhere, I was referring to garbage collection, not manual memory management.

As in, C++ std::shared_ptrs for holding references to GC objects and std::allocate_shared, for allocating memory that will be GCed.

But still, there are Node CLI args you can pass, might wanna find 'em.

xxpertHacker (865)

@AmazingMech2418 Well... 137 is a OOM (out-of-memory) error, so... good luck with that.

:)

(I recommend trying to break the container, that should work, right? Force the VM to comply with your demands for memory)

AmazingMech2418 (1039)

@xxpertHacker Well, it's a Docker port, so I don't think I can do that. And I don't want to get banned. LOL!

xxpertHacker (865)

@AmazingMech2418 Yeah, I doubted it too. It was an idea.

But then again, maybe it's just the way that you had written the code?

ChezCoder (1589)

LMAO

Mother: Hey son watcha doin?

AmazingMech: ehh just coding up a quantum computer... y'know, normal stuff

Mother: .

AmazingMech2418 (1039)

@ChezCoder LOL! Though, it's a quantum computer simulator.

DynamicSquid (4630)

Yeah, so I'm working on this quantum computer, just normal stuff.

Bruh, like where do you even start?

fuzzyastrocat (1513)

@DynamicSquid
1. Learn the basics of quantum computing
2. Learn the gates
3. Learn the basics of quantum computing
4. Learn the gates
5. Learn the basics of quantum computing
6. Google "matrix algebra"
7. Keep googling "matrix algebra"
8. Learn the basics of quantum computing
...

AmazingMech2418 (1039)

@DynamicSquid Well, it took quite a bit to figure out multi-qubit matrices. LOL! And like 10 pieces of paper.

RYANTADIPARTHI (6009)

I think one way will be to get the hacker plan, but i don't think the memory should run out that fast, even without the hacker plan.

realTronsi (913)

@RYANTADIPARTHI he is making a quantum computer simulator

AmazingMech2418 (1039)

I just tested it and 11 qubits is beyond the max. It works for 10, but not 11.