-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update CP2K easyblock for compatibility with CP2K v2023.1 release (GCC only) + fix GPU support #2918
base: develop
Are you sure you want to change the base?
Conversation
@osbama Thanks a lot for your contribution! Before we take a detailed look at the proposed changes, can you look into fixing the code style problems that the Hound bot is reporting? Some high-level info is available at https://docs.easybuild.io/code-style. Do let us know if you have any questions (either in here, or via the EasyBuild Slack). |
I find the need to specify the gpuver stuff painful. I think we'd very much like to use out cuda-compute-capabilities that we already specify. I had a look through the CP2K code to see where is actually needs to specify 1 single type, and why the heck it needs to specify the product name instead of just the compute capabilities. I think most of the CP2K code would just work for any (multiple even) cuda compute capabilities, if only they got rid of their unnecessary stuff where they check for the product names (ugh, painful). Digging deeper, i did find that there was one place where was truly unfortunately limited to just building with only 1 compute capability; Ugh. OK, i guess due to this i suppose this is one of those softwares that are specific to one CCC. A few options we could have;
|
@osbama Thanks a lot for the contribution! I think this will need some work before we can merge it though, not only because of @Micket's feedback, but also because of the @Micket W.r.t. |
Hi @boegel, Please check out the linked discussion in CP2K. The method CP2K developer suggested is quite different than the currently implemented one. CP2K is a modular architecture that can get quite challenging to compile, furthermore sometimes older versions do some things better than newer versions, and to make things even more complicated, some modules may refuse to get compiled in the aformentioned method, so I decided not to radically alter the build procedure, but add a new one based on the suggestion of CP2K developer. If one insists, or skips some capability like GPU for the sake of some other packages/optimizations, I am sure the previous method can be made to compile the newer version, although I didn't try it myself. Maybe the name can be changed to "alternate_compilation_mode" or something similar? BTW, gpuver makes the life of people with heterogenous systems and restrictive compilation conditions very easy, I will be sad if it is removed. |
@osbama The problem is not so much that you're switching to a new installation method, that should be fine as long as we opt-in to it consistently starting with a particular CP2K version (and keep using the old method for older CP2K versions). Unless there's a reason that doesn't make sense which I'm overlooking here? The main problem with By default, when |
@boegel gpuver is hardcoded because: My compile environment is strictly cross compile for GPUs in a heterogeneous GPU environment. In my experience CUDA checks only if there is a NVIDIA card in the system (copyright?), does not complain if the card is not capable of that calculation mode. If autodetection is forced, it will compile for an irrelevant GPU. it will really make admins of heterogenous systems like mine very upset. Even if compute capability to CP2K naming scheme shall be implemented, in my opinion it should not be forced. I think it is better to set it to a minimum compute accepted, newer cards will run that code, and those who want to tune the compilation for performance, will edit the eb file anyhow. My humble opinion: It is nice to have everything automated, but automation works acceptably only if everything adheres to a particular and strict standard. Standards vary wildly especially in the developing world, where the rule "something is better than nothing" dominates. If automation will make the life of some admins harder, it is much more efficient to make it strictly optional. |
@@ -103,14 +105,16 @@ def extra_options(): | |||
'plumed': [None, "Enable PLUMED support", CUSTOM], | |||
'type': ['popt', "Type of build ('popt' or 'psmp')", CUSTOM], | |||
'typeopt': [True, "Enable optimization", CUSTOM], | |||
'v2023': [False, "2023 version of CP2K", CUSTOM], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a config option, use LooseVersion(get_software_version('CP2K')) to figure out if it is 2023 or newer instead.
'FPIC': self.fpic, | ||
'DFLAGS': ' -D__parallel -D__BLACS -D__SCALAPACK -D__FFTSG %s' % self.cfg['extradflags'], | ||
'INCS': '', | ||
'CFLAGS': '-O3 -fopenmp -ftree-vectorize -march=native -fno-math-errno -fopenmp -std=c11 $(FPIC) $(DEBUG) ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the way to do it, do not hardcode compiler flags like this.
-march=native only works for GCC for instance.
The old code was correct apart from the missing INCS and DFLAGS.
'FREE': '-ffree-form -ffree-line-length-none -std=f2008', | ||
}) | ||
options[ | ||
'FCFLAGSOPT'] = '-O3 -ftree-vectorize -march=native -fno-math-errno -fopenmp -fPIC $(FREE) $(DFLAGS) ' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, don't hardcode compiler options
'f90': os.getenv('F90'), | ||
'base': os.path.dirname(os.path.normpath(self.cfg['start_dir'])), | ||
'cp2k_version': self.cfg['type'], | ||
'triplet': self.typearch, | ||
'cp2k_dir': os.path.basename(os.path.normpath(self.cfg['start_dir'])), | ||
'maxtasks': self.cfg['maxtasks'], | ||
'mpicmd_prefix': self.toolchain.mpi_cmd_for('', test_core_cnt), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an unintended shift-right
CP2K has had a recent release v2023.1. This release has significant improvements on the GPU side.
The current cp2k easyblock does not produce an executable using foss chain for this version. I have contacted CP2K developers, and Alfio Lazzaro fixed the arch file generated by cp2k see the thread here
I have implemented the new
gpuarch
and tried to replicate the arch file fixed by Alfio Lazzarro as close as possible. I have created a newextra_option
calledv2023
to contain the changes. The reason I did not do this by checking the version is that, the GPU compilation for the previous release also does not work with the current easyblock, whereas this arch file seems to work.I have tested this on a Epyc/A100 based system, and the binary seems fine.
Please notice that I am an absolute newbie to easybuild. Please check the modifications carefully.
I will also submit a pull request for the easyconfig file I have used.
Thanks,
Baris