ck
ck copied to clipboard
[CK legacy] Compiling with mpicc
Hello again,
as mentioned in #136 i just started using ck, so maybe this is a question that seems obvious as a long-term user.
Usecase: Simple MPI program in C, compiled with mpicc -o dummyMPI dummyMPI.c dummyMPI.h
How do i add mpicc (either openmpi or mpich) to the meta.json?
I registered both (with ck detect soft:lib.openmpi
and ck detect soft:lib.openmpi
) but i'm struggling to find the corresponding compiler entries for the meta.json. I understood that i have to add compile_deps, but i don't know which ones and how.
I found an example on how to use mpi as a library https://github.com/ctuning/ck-scc18/wiki#using-intel-compilers-and-mpi but if I'm interpreting the tags in the corresponding meta.json correctly, than it is not compiled with mpicc but just run with mpirun or am i missing something?
Thank you very much and merry Christmas!
Hi Sebastian,
I somehow missed this message - sorry about that! Happy New Year!
To be able to use the CK compiler automation for mpicc, it should have a related compiler soft entry, something like "compiler.mpicc" with a tag "compiler". We do not have such entry at the moment, so you have two options:
- simple option: just use your own compile script inside program entry and update its meta json accordingly. See a related example here:
- https://github.com/ctuning/ai/blob/main/program/template-hello-world-c-compile-run-via-scripts/ck_compile.sh
- https://github.com/ctuning/ai/blob/main/program/template-hello-world-c-compile-run-via-scripts/.cm/meta.json#L51
- https://github.com/ctuning/ai/blob/main/program/template-hello-world-c-compile-run-via-scripts/.cm/meta.json#L4
Note that this example still uses standard C compiler as a dependency - you can remove it and substitute CK_CC with mpicc in this script...
- You can create an mpicc soft entry based on GCC example as follows:
ck cp soft:compiler.gcc soft:compiler.mpicc
ck edit soft:compiler.mpicc
and then substitute all keys related to gcc with mpicc.
In such case, you should be able to add mpicc compiler dependency to your program and use CK compilation automation similar to this example. You just need to change the dependency tag in meta.json from gcc to mpicc ...
I believe Patrick (@phesse001) is also working on similar HPC workflows so I added him to CC.
Hope it's of any help!
By the way, I will be off-line most of this January so would like to apologize for the delays in replying ...
We may consider this support in the CK2 framework though it's not a priority at the moment...
Since we will be implementing this in CM, I am closing this ticket.