Skip to content
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 LAMMPS easyblock for LAMMPS/23Jun22 #2213

Merged
merged 33 commits into from
Jul 22, 2022

Conversation

ocaisa
Copy link
Member

@ocaisa ocaisa commented Oct 28, 2020

This easyblock supports the patch release 22Oct20 of LAMMPS, which is rc2 for the next stable release. Unfortunately it is not currently backwards compatible so is a WIP until we figure that out.

UPDATE:
This now supports the latest stable version of LAMMPS (23Jun2022)

@boegel boegel added the update label Nov 11, 2020
@boegel boegel added this to the 4.x milestone Nov 11, 2020
@ocaisa ocaisa changed the title Update LAMMPS easyblock for LAMMPS/22Oct20 Update LAMMPS easyblock for LAMMPS/29Oct20 Jan 27, 2021
@rarensu
Copy link

rarensu commented Nov 24, 2021

Dependency YAFF is not compatible with the newer h5py yet. I turned the YAFF extension off rather than try to deal with downgrades or other hacky nonsense. Eventually YAFF will catch up and we can turn it back on.

@arkdavy
Copy link

arkdavy commented Mar 18, 2022

Hi. I have updated the easyblock, and it builds now both 3Mar20 and 29Sep21 releases (and, therefore, 22Oct20 should also work). I could submit my changes to this PR, but not sure how to do that. So, could you check the attached easyblock? (which needs to be renamed to 'lammps.py')

lammps.zip

@ocaisa
Copy link
Member Author

ocaisa commented Mar 23, 2022

Sorry, I did take an initial look at this but I haven't had time to incorporate it yet (and won't for at least another two weeks). The one point I would raise is that it is likely that your version comparisons is not working correctly. LAMMPS has unfortunate versions which looseversion is unlikely to get right. At least it is predictable though, I think we will need to implement a version mapping function that will translate 29Oct2020 to 2020.10.29 to ensure we get that right.

@ocaisa
Copy link
Member Author

ocaisa commented Mar 23, 2022

For version translation, something like this would work:

import re
def translate_version(version):
    items = [x for x in re.split('(\d+)', version) if x]
    if len(items) != 3:
        raise ValueError("Version %s does not have 3 elements" % version)
    month_map = {"JAN": '01', "FEB": '02', "MAR": '03', "APR": '04', "MAY": '05', "JUN": '06', "JUL": '07', "AUG": '08', "SEP": '09', "OCT": '10', "NOV": '11', "DEC": '12'}
    return items[2] + month_map[items[1].upper()] + items[0]

@arkdavy
Copy link

arkdavy commented Mar 23, 2022

Thanks for the hint and for the function template!

I thought LoosVersion would work with any format, but let me add and test this function into lammps.py. I will just re-attach an updated version later.

@ocaisa
Copy link
Member Author

ocaisa commented Mar 23, 2022

I tested it out just to be sure:

[ocaisa@xlnode1 ~]$ python -c "from distutils.version import LooseVersion; print(LooseVersion('28Sep2021') > LooseVersion('29Sep2020'))"
False

@arkdavy
Copy link

arkdavy commented Mar 23, 2022

yeah, I have also seen it! So, the function you suggested did work, and here is an updated file
lammps.txt

@ocaisa ocaisa marked this pull request as ready for review May 13, 2022 13:29
@ocaisa
Copy link
Member Author

ocaisa commented May 13, 2022

I tested this for the 3Mar2020 release and it gives an identical configure command to the existing easyblock.

@ocaisa
Copy link
Member Author

ocaisa commented May 13, 2022

Test report by @ocaisa

Overview of tested easyconfigs (in order)

Build succeeded for 0 out of 1 (1 easyconfigs in total)
login1 - Linux Rocky Linux 8.5, x86_64, Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz, Python 3.6.8
See https://gist.github.com/1ec5f32d0fc83df84676d43d43daad5b for a full test report.

ocaisa and others added 3 commits July 21, 2022 11:42
Co-authored-by: Simon Branford <4967+branfosj@users.noreply.github.com>
@branfosj
Copy link
Member

Test report by @branfosj

Overview of tested easyconfigs (in order)

  • *FAIL (unhandled exception: list index out of range)Traceback (most recent call last):
    File "/rds/projects/2017/branfosj-rse/easybuild/src/easybuild-framework/easybuild/main.py", line 128, in build_and_install_software
    (ec_res['success'], app_log, err) = build_and_install_one(ec, init_env)
    File "/rds/projects/2017/branfosj-rse/easybuild/src/easybuild-framework/easybuild/framework/easyblock.py", line 4077, in build_and_install_one
    result = app.run_all_steps(run_test_cases=run_test_cases)
    File "/rds/projects/2017/branfosj-rse/easybuild/src/easybuild-framework/easybuild/framework/easyblock.py", line 3960, in run_all_steps
    self.run_step(step_name, step_methods)
    File "/rds/projects/2017/branfosj-rse/easybuild/src/easybuild-framework/easybuild/framework/easyblock.py", line 3795, in run_step
    step_method(self)()
    File "/dev/shm/branfosj/tmp-up-EL8/included-easyblocks-hwqtmlmr/easybuild/easyblocks/lammps.py", line 392, in configure_step
    python_lib = glob.glob("%s/lib
    /libpython%s.so" % (python_dir, python_short_version))[0]
    IndexError: list index out of range
    ** LAMMPS-3Mar2020-foss-2019b-Python-3.7.4-kokkos.eb

Build succeeded for 0 out of 1 (1 easyconfigs in total)
bear-pg0211u03a.bear.cluster - Linux RHEL 8.6, x86_64, Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz (cascadelake), Python 3.6.8
See https://gist.github.com/0e3a26dfd88506ed161ba7952f4ed277 for a full test report.

python_dir = get_software_root('Python')
if python_dir:
python_short_version = '.'.join(get_software_version('Python').split('.')[:2])
python_lib = glob.glob("%s/lib*/libpython%s.so" % (python_dir, python_short_version))[0]
Copy link
Member

@branfosj branfosj Jul 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Python 3.7 (2019b) the library is libpython3.7m.so, which is why I see #2213 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goes off to recall how to include an optional m

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python -c "import sysconfig; print(sysconfig.get_config_var('abiflags'))"

Is from https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/p/python.py#L511 - i.e. how we check for the right library in the Python easyblock.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Urgh, I should have waited before committing 9f9591b, will fix now

@ocaisa
Copy link
Member Author

ocaisa commented Jul 22, 2022

Test report by @ocaisa

Overview of tested easyconfigs (in order)

  • *FAIL (unhandled exception: list index out of range)Traceback (most recent call last):
    File "/home/ocaisa/EasyBuild_Git/easybuild-framework/easybuild/main.py", line 128, in build_and_install_software
    (ec_res['success'], app_log, err) = build_and_install_one(ec, init_env)
    File "/home/ocaisa/EasyBuild_Git/easybuild-framework/easybuild/framework/easyblock.py", line 4077, in build_and_install_one
    result = app.run_all_steps(run_test_cases=run_test_cases)
    File "/home/ocaisa/EasyBuild_Git/easybuild-framework/easybuild/framework/easyblock.py", line 3960, in run_all_steps
    self.run_step(step_name, step_methods)
    File "/home/ocaisa/EasyBuild_Git/easybuild-framework/easybuild/framework/easyblock.py", line 3795, in run_step
    step_method(self)()
    File "/tmp/eb-bqftmjfd/included-easyblocks-op9r_ga4/easybuild/easyblocks/lammps.py", line 396, in configure_step
    python_lib_path = glob.glob(os.path.join(python_dir, 'lib
    ', python_lib))[0]
    IndexError: list index out of range
    ** LAMMPS-3Mar2020-foss-2020a-Python-3.8.2-kokkos.eb

Build succeeded for 0 out of 1 (1 easyconfigs in total)
login1 - Linux Rocky Linux 8.5, x86_64, Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz, Python 3.6.8
See https://gist.github.com/7f862cf2aee83149e0a2634337f62759 for a full test report.

@ocaisa
Copy link
Member Author

ocaisa commented Jul 22, 2022

Test report by @ocaisa

Overview of tested easyconfigs (in order)

  • SUCCESS LAMMPS-3Mar2020-foss-2020a-Python-3.8.2-kokkos.eb

Build succeeded for 1 out of 1 (1 easyconfigs in total)
login1 - Linux Rocky Linux 8.5, x86_64, Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz, Python 3.6.8
See https://gist.github.com/27188bbeef5491ac93404649392c9193 for a full test report.

@branfosj
Copy link
Member

Test report by @branfosj

Overview of tested easyconfigs (in order)

Build succeeded for 1 out of 3 (3 easyconfigs in total)
bear-pg0211u03a.bear.cluster - Linux RHEL 8.6, x86_64, Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz (cascadelake), Python 3.6.8
See https://gist.github.com/c9baaff78aca40aa2edbed877b5d5378 for a full test report.

@ocaisa
Copy link
Member Author

ocaisa commented Jul 22, 2022

@branfosj Both of those builds are failing on the same issue:

fatal error: Python.h: No such file or directory

Could that be true? Am I picking up the wrong Python include path?

@ocaisa
Copy link
Member Author

ocaisa commented Jul 22, 2022

Urgh, yeah, the files are in a subdirectory...grr

@branfosj
Copy link
Member

Failed runs with Python 3.7.4, the relevant parts are:

-DPython_EXECUTABLE=/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.7.4-GCCcore-8.3.0/bin/python
-DPYTHON_EXECUTABLE=/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.7.4-GCCcore-8.3.0/bin/python
-DPYTHON_LIBRARY=/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.7.4-GCCcore-8.3.0/lib64/libpython3.7m.so
-DPYTHON_INCLUDE_DIR=/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.7.4-GCCcore-8.3.0/include

Success with Python 3.8.2:

-DPython_EXECUTABLE=/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.8.2-GCCcore-9.3.0/bin/python
-DPYTHON_EXECUTABLE=/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.8.2-GCCcore-9.3.0/bin/python
-DPYTHON_LIBRARY=/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.8.2-GCCcore-9.3.0/lib64/libpython3.8.so
-DPYTHON_INCLUDE_DIR=/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.8.2-GCCcore-9.3.0/include

Location of Python.h:

/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.7.4-GCCcore-8.3.0/include/python3.7m/Python.h
/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.8.2-GCCcore-9.3.0/include/python3.8/Python.h

Ah, in the actual build lines

2019b the only Python include is:

-I/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.7.4-GCCcore-8.3.0/include 

but for 2020a we've gained an extra include path:

-I/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.8.2-GCCcore-9.3.0/include 
-I/rds/projects/2017/branfosj-rse/easybuild/EL8-cas/software/Python/3.8.2-GCCcore-9.3.0/include/python3.8

However, I am not seeing information in the log as to what caused that extra include to appear for 2020a.

@ocaisa
Copy link
Member Author

ocaisa commented Jul 22, 2022

@branfosj Should be fixed with 616caf7

@ocaisa
Copy link
Member Author

ocaisa commented Jul 22, 2022

Test report by @ocaisa

Overview of tested easyconfigs (in order)

  • SUCCESS LAMMPS-3Mar2020-foss-2020a-Python-3.8.2-kokkos.eb

Build succeeded for 1 out of 1 (1 easyconfigs in total)
login1 - Linux Rocky Linux 8.5, x86_64, Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz, Python 3.6.8
See https://gist.github.com/49eb971aa1b5687655e880b407f5dd84 for a full test report.

@branfosj
Copy link
Member

Test report by @branfosj

Overview of tested easyconfigs (in order)

  • SUCCESS LAMMPS-3Mar2020-foss-2019b-Python-3.7.4-kokkos.eb
  • SUCCESS LAMMPS-3Mar2020-foss-2020a-Python-3.8.2-kokkos.eb
  • SUCCESS LAMMPS-7Aug2019-foss-2019b-Python-3.7.4-kokkos.eb

Build succeeded for 3 out of 3 (3 easyconfigs in total)
bear-pg0211u03a.bear.cluster - Linux RHEL 8.6, x86_64, Intel(R) Xeon(R) Gold 6248 CPU @ 2.50GHz (cascadelake), Python 3.6.8
See https://gist.github.com/2ec0691ff9de57f49aa0a2abcdc390e4 for a full test report.

Copy link
Member

@branfosj branfosj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@branfosj branfosj modified the milestones: 4.x, next release (4.6.1?) Jul 22, 2022
@branfosj
Copy link
Member

Going in, thanks @ocaisa!

@branfosj branfosj merged commit c5d76b0 into easybuilders:develop Jul 22, 2022
@ocaisa ocaisa deleted the lammps_allow_disable_cuda branch July 22, 2022 12:40
@boegel boegel changed the title Update LAMMPS easyblock for LAMMPS/23Jun22 update LAMMPS easyblock for LAMMPS/23Jun22 Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants