MacBook – will the code keep running when Mac is in sleep mode

lidmacbook pro

I am running a code with AMPL. its very heavy model. I am wondering will my code keep running if my Mac is in sleep mode or if I close lid?

my Mac is pro 13 inch 2019.

when I started run the code my Mac made a noise very loud. it is very hot now. when it goes to sleep mode I think it become colder!
That's why I am asking

Best Answer

In short... No.

It's an either/or.

Either your code is running...
...or your machine is asleep.

You cannot have both at once.

Whatever is running may prevent sleep, or it may not.
You can test for that in Activity Monitor [Applications/Utilities] If you right click any of the headers & add 'Preventing sleep' you'll be able to tell if anything will prevent it or will just allow the machine to sleep at the set time.

enter image description here