Skip to content

add easyblock for RAxML#2180

Closed
lexming wants to merge 8 commits intoeasybuilders:developfrom
lexming:raxml
Closed

add easyblock for RAxML#2180
lexming wants to merge 8 commits intoeasybuilders:developfrom
lexming:raxml

Conversation

@lexming
Copy link
Copy Markdown
Contributor

@lexming lexming commented Sep 16, 2020

This easyblock automatically builds those binaries of RAxML that

  1. use optimizations available in the CPU micro-architecture of the host system (respects optarch settings)
  2. have features compatible with the toolchain used in the build

Current easyconfigs of RAxML build one arbitrary binary of RAxML and create a symlink with the name raxmlHPC. This is a bad approach because the different binaries of RAxML have different requirements and features. For instance, binaries using MPI have a minimum number of trees to process

This is RAxML MPI Process Number: 0

WARNING: The number of threads is currently set to 0
You can specify the number of threads to run via -T numberOfThreads
NumberOfThreads must be set to an integer value greater than 1

RAxML, will now set the number of threads automatically to 2 !

Error: you are running the parallel MPI program but only want to compute one tree
For the MPI version you must specify a number of trees greater than 1 with the -# or -N option

@lexming lexming added the new label Sep 16, 2020
@lexming lexming added this to the 4.x milestone Sep 16, 2020
@lexming
Copy link
Copy Markdown
Contributor Author

lexming commented Sep 16, 2020

Comment thread easybuild/easyblocks/r/raxml.py Outdated
Comment thread easybuild/easyblocks/r/raxml.py Outdated
Comment thread easybuild/easyblocks/r/raxml.py Outdated
@lexming
Copy link
Copy Markdown
Contributor Author

lexming commented Feb 27, 2023

@lexming
Copy link
Copy Markdown
Contributor Author

lexming commented Feb 27, 2023

Test report by @lexming

Overview of tested easyconfigs (in order)

  • SUCCESS RAxML-8.2.12-GCC-11.3.0.eb
  • SUCCESS RAxML-8.2.12-gompi-2022a.eb

Build succeeded for 2 out of 2 (2 easyconfigs in total)
node300.hydra.os - Linux CentOS Linux 7.9.2009, x86_64, Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz (skylake_avx512), Python 3.6.8
See https://gist.github.com/c11b4d9e09219333dbd36fcf85a32ba3 for a full test report.

@boegel boegel modified the milestones: 4.x, next release (4.7.1) Mar 1, 2023
@boegel
Copy link
Copy Markdown
Member

boegel commented Mar 15, 2023

@lexming Some existing RAxML easyconfigs have raxmlHPC -v and raxmlHPC -h as sanity check commands, we can let this easyblock run those too?

from easybuild.tools.systemtools import get_cpu_features, HAVE_ARCHSPEC
from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC

RAXML_BINARY_NAME = "raxmlHPC"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure RAXML_BINARY_NAME is useful, since it's only used in one place currently?


RAXML_BINARY_NAME = "raxmlHPC"
# Supported instruction sets ordered by priority (high to low) and related CPU features
RAXML_INSTRUCT_SETS = ["AVX2", "AVX", "SSE3"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about AVX-512? If there's a reason no to include that, add a comment on it?
Where can the list of supported instruction sets be found (docs link? README?)

Also, out of curiosity, does it also support NEON (for aarch64)?
If someone cares enough the easyblock can be updated later to also cover that, doesn't need to be done here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

They don't support that in their makefiles, this choice reflects what they actually set in CFLAGS (they do not respect the CFLAGS in the environment)

# Supported instruction sets ordered by priority (high to low) and related CPU features
RAXML_INSTRUCT_SETS = ["AVX2", "AVX", "SSE3"]
RAXML_CPU_FEATURES = {
"SSE3": ["sse3", "see4_1", "sse4_2"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo:

Suggested change
"SSE3": ["sse3", "see4_1", "sse4_2"],
"SSE3": ["sse3", "sse4_1", "sse4_2"],

"""RAxML easyblock constructor, define class variables."""
super(EB_RAxML, self).__init__(*args, **kwargs)

def filter_optarch_features(support_features):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make this a function outside of the easyblock? Same for others below.

Advantage is that tests can be added easily to CI for these, and code becomes quite a bit easier to parse for humans

return feature.lower() in host

try:
return any(f in get_cpu_features() for f in RAXML_CPU_FEATURES[feature])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be nicer with a single return as the end, I'm not a big fan of inline returns, see also https://realpython.com/python-return-statement/#remembering-the-return-value (but that's partially personal, I guess)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe this function should be moved into framework, it's pretty generic... Same for filter_optarch_features

# unrestricted optimization settings, set optimization level for host micro-architecture
cpu_features = [feat for feat in cpu_features if has_cpu_feature(feat)]
dbg_msg = "Enabling the following CPU optimizations for RAxML by autodetection: %s"
self.log.debug(dbg_msg, ", ".join(cpu_features))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make this info log message?

dbg_msg = "Enabling the following CPU optimizations for RAxML by autodetection: %s"
self.log.debug(dbg_msg, ", ".join(cpu_features))
# add generic build
cpu_features.append(None)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you clarify (in the comment) why this is done?

parallel_features.extend(RAXML_PARALLEL_FEATURES["mpi"])

# List of builds to carry out
self.target_makefiles = list_filename_variants(cpu_features, parallel_features, "Makefile", "gcc", ".")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is always using gcc OK? What if we're installing RAxML with Intel compilers?

if not any(feature in mf for feature in RAXML_PARALLEL_FEATURES["mpi"]):
cc_opt = compiler_nompi
self.cfg["buildopts"] = '-f %s CC="%s" %s' % (mf, cc_opt, user_buildopts)
self.log.debug("Building RAxML makefile with %s: %s", cc_opt, mf)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

log.info?

"files": [os.path.join("bin", x) for x in self.target_bins],
"dirs": ["share/manual", "share/usefulScripts"],
}
super(EB_RAxML, self).sanity_check_step(custom_paths=custom_paths)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also include a custom sanity check command like raxmlHPC -h?

@akesandgren
Copy link
Copy Markdown
Contributor

@lexming this easyblock needs some attention...

@boegel boegel removed this from the next release (4.8.2) milestone Oct 27, 2023
@boegel boegel added this to the release after 4.8.2 milestone Oct 27, 2023
@boegel boegel modified the milestones: 4.9.1, release after 4.9.1 Apr 3, 2024
@boegel boegel modified the milestones: 4.9.2, release after 4.9.2 Jun 6, 2024
@boegel boegel modified the milestones: 4.9.3, release after 4.9.3 Sep 11, 2024
@boegel boegel modified the milestones: release after 4.9.4, release after 5.0.0 Mar 18, 2025
@boegel boegel modified the milestones: next release (5.1.0), 5.x May 22, 2025
@ocaisa
Copy link
Copy Markdown
Member

ocaisa commented Oct 8, 2025

There's good knowledge in here about what to actually build (it's clear you probably need a serial and a parallel build). The actual Makefiles they ship are not very complicated. Rather than do architecture detection etc., what I'm thinking of doing is just creating patched versions that respect the EasyBuild compilers and options, build both the serial and parallel versions and leave it at that.

The files that are being compile are 10+ years old, and in the commit that includes the performance optimisation they mention the improvement being 5-10% with GCC 4.7+...how would that compare with a modern compiler?

@boegel
Copy link
Copy Markdown
Member

boegel commented Oct 8, 2025

@lexming
Copy link
Copy Markdown
Contributor Author

lexming commented Nov 18, 2025

@ocaisa I fully agree, closing this in favour of easybuilders/easybuild-easyconfigs#23975

@lexming lexming closed this Nov 18, 2025
@lexming lexming deleted the raxml branch November 18, 2025 08:54
@lexming lexming modified the milestones: 5.x, next release (5.2.0?) Nov 18, 2025
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