[CP2K-GPU] GPU acceleration of cp2k

569 views
Skip to first unread message

Yuvam Bhateja

unread,
May 25, 2020, 9:54:29 AM5/25/20
to cp...@googlegroups.com
Hey,
I wish to accelerate my cp2k calculation using GPU as my system is quite big.
I have two options- 
Either to use free GPU offered by Google colab notebook which uses python.
Or I can run it on my laptop with GPU which has Windows and other OS cannot be installed on it for some reason.

Can anyone help me with this?

Regards
Yuvam Bhateja
India

Fabian Ducry

unread,
May 26, 2020, 3:10:31 AM5/26/20
to cp2k
Dear Yuvam,

I am not sure what your question is, what do you need help with?

To run cp2k in colab you can use something like this to install the tool:

%%bash

# Execute this cell on Ubuntu only
if grep -e "ID=ubuntu" /etc/os-release ; then \
   echo 'Continue on Ubuntu' ; \
else \
   echo 'Does not look like an Ubuntu box, exiting' ; \
   exit ; \
fi

apt update
apt-get install cp2k
pip install ase

export ASE_CP2K_COMMAND="mpirun -np 2 cp2k_shell.popt"

an then use the following to run cp2k:

from ase.calculators.cp2k import CP2K
from ase.build import molecule
calc = CP2K()
atoms = molecule('H2O', calculator=calc)
atoms.center(vacuum=2.0)
print(atoms.get_potential_energy())

This cannot use GPUs, however. I don't think there is a package with GPU support, you would have to compile it yourself.

Fabian

Yuvam Bhateja

unread,
May 26, 2020, 3:37:10 AM5/26/20
to cp...@googlegroups.com
Sir,
Thank you for your reply.
I want to accelerate my cp2k calculation using gpu since my atomic system is quite big.
As google colab provides free GPU I wish to use that. You mentioned in code the mpi which is for cpu parallel computing. Is there any way to compile it using cuda which is for gpu parallelization. 

Regards
Yuvam Bhateja

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/4703be55-575a-4cc2-92b4-f4fea103ed0a%40googlegroups.com.

Fabian Ducry

unread,
May 26, 2020, 3:53:06 AM5/26/20
to cp2k
You can compile cp2k on your local machine (https://www.cp2k.org/howto:compile_with_cuda). Then you need to find a way to upload the executable and libraries to the colab VM. There is no one-click-solution for that, I'm afraid.


Fabian

Yuvam Bhateja

unread,
May 26, 2020, 4:07:58 AM5/26/20
to cp...@googlegroups.com
Thank you for the advice sir

So, if I upload it, can I incorporate it with ase and python ase-cp2k commands?

On Tue, 26 May 2020, 1:23 pm Fabian Ducry, <fabia...@gmail.com> wrote:
You can compile cp2k on your local machine (https://www.cp2k.org/howto:compile_with_cuda). Then you need to find a way to upload the executable and libraries to the colab VM. There is no one-click-solution for that, I'm afraid.


Fabian

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.

Fabian Ducry

unread,
May 26, 2020, 4:10:34 AM5/26/20
to cp2k
If it's compiled correctly for the target hardware, it should work. But you just have to try it...

Yuvam Bhateja

unread,
May 26, 2020, 4:17:04 AM5/26/20
to cp...@googlegroups.com
Thank you for the help sir.

I want to ask one more question.
Is there a way install cuda enabled cp2k on windows system?

On Tue, 26 May 2020, 1:40 pm Fabian Ducry, <fabia...@gmail.com> wrote:
If it's compiled correctly for the target hardware, it should work. But you just have to try it...

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.

Fabian Ducry

unread,
May 26, 2020, 4:23:58 AM5/26/20
to cp2k
I would not recommend compiling on Windows if you target an Ubuntu VM on google colab. I doubt that this will work.

Yuvam Bhateja

unread,
May 26, 2020, 4:29:43 AM5/26/20
to cp...@googlegroups.com
I have another option to run cp2k with gpu acceleration actually.
I can use my windows system with dedicated cuda supported GPU to run cp2k. But again the problem is it has windows and no other OS can be installed for some reason.

Can you please assist me regarding installing cuda compiled cp2k on windows?

On Tue, 26 May 2020, 1:54 pm Fabian Ducry, <fabia...@gmail.com> wrote:
I would not recommend compiling on Windows if you target an Ubuntu VM on google colab. I doubt that this will work.

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.

Fabian Ducry

unread,
May 26, 2020, 5:47:35 AM5/26/20
to cp2k
To add cuda support you need the cudatoolkit and visual studio.

Reply all
Reply to author
Forward
0 new messages