Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
135d880
Pass correct -march option in RISC-V when 'optarch': True is used
julianmorillo Oct 20, 2025
5ae6951
Correct a couple of issues detected by the hound
julianmorillo Oct 20, 2025
35baab2
Solve line too long and trailing whitespace
julianmorillo Oct 20, 2025
4b4310d
Merge branch 'easybuilders:develop' into develop
julianmorillo Oct 28, 2025
6bf2437
Use regular expression instead pipeline using grep
julianmorillo Oct 28, 2025
6409794
Add a couple of tests for the new get_isa() function
julianmorillo Oct 28, 2025
291b43d
Remove unused import RISCV64
julianmorillo Oct 28, 2025
f9035b5
Correctly initialize isa_string
julianmorillo Oct 28, 2025
e2f0f7e
Remove trailing whitespace
julianmorillo Oct 28, 2025
494a2e5
Update easybuild/tools/systemtools.py
julianmorillo Oct 31, 2025
1f9ed66
Merge branch 'easybuilders:develop' into develop
julianmorillo Oct 31, 2025
76a3d8e
Change get_isa() to get_isa_riscv() (as it is a RISC-V specific
julianmorillo Oct 31, 2025
69f243e
Solve E501 line too long
julianmorillo Oct 31, 2025
b4f215e
Consider 'rv64gc' as fallback return value and avoid raising an
julianmorillo Oct 31, 2025
6894973
Fix function name in import
julianmorillo Oct 31, 2025
595bdb2
Fix calls to get_isa_riscv() in test/framework/systemtools.py
julianmorillo Oct 31, 2025
78c5fd8
Change fallback return value to 'rv64imafdc' (it is how 'rv64gc' is
julianmorillo Oct 31, 2025
76e6881
Merge branch 'easybuilders:develop' into develop
julianmorillo Dec 9, 2025
bb5c5fa
Add a comment to clarify what 'rv64imafdc' is/means, and why it's a
julianmorillo Dec 9, 2025
6bdd9f9
Better test example that does not use the default value used by
julianmorillo Dec 9, 2025
f4d81fb
Remove trailing whitespaces
julianmorillo Dec 9, 2025
07ab462
Merge branch 'easybuilders:develop' into develop
julianmorillo Dec 10, 2025
21d3bcf
Correct regular expression to detect ISA
julianmorillo Dec 10, 2025
3673cc3
Merge branch 'easybuilders:develop' into develop
julianmorillo Dec 16, 2025
c5fa0a4
Add links with documentation on RISC-V ISA field and -march GCC's option
julianmorillo Dec 16, 2025
48ead25
tweak get_isa_riscv to return None on non-RISCV systems, and to sort …
boegel Dec 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions easybuild/toolchains/compiler/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class Gcc(Compiler):
# no support for -march on POWER; implies -mtune=native
(systemtools.POWER, systemtools.POWER): '-mcpu=native',
(systemtools.POWER, systemtools.POWER_LE): '-mcpu=native',
(systemtools.RISCV64, systemtools.RISCV): '-march=' + systemtools.get_isa(), # use all available extensions
(systemtools.X86_64, systemtools.AMD): '-march=native', # implies -mtune=native
(systemtools.X86_64, systemtools.INTEL): '-march=native', # implies -mtune=native
}
Expand Down
21 changes: 21 additions & 0 deletions easybuild/tools/systemtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,27 @@ def get_cpu_features():
return cpu_feat


def get_isa():
"""
Get supported ISA string
"""
isa_string = None
os_type = get_os_type()
if os_type == LINUX:
if is_readable(PROC_CPUINFO_FP):
cmd = "cat /proc/cpuinfo | grep isa | head -1 | cut -d':' -f2"
Copy link
Member

Choose a reason for hiding this comment

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

Rather than relying on a pipeline, can't we just read /proc/cpuinfo as a file (with read_file), and then use a regular expression to grab the isa part?

Also, grep isa is a bit too loose (on an x86_64 system, it matches misalignsse in flags, for example).

How portable is this across CPU families?
If it's not, we should make this function specific to RISC-V, and return None on non-RISC-V systems?

We should also add some tests when introducing a new function like this...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added new commits that try to address all the comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably be risc-v specific (changing the function name to something like get_isa_riscv)

Atleast on my intel CPU the closest thing would be the flags : ...

Details

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 183
model name      : 13th Gen Intel(R) Core(TM) i9-13900K
stepping        : 1
microcode       : 0x12f
cpu MHz         : 1053.547
cache size      : 36864 KB
physical id     : 0
siblings        : 32
core id         : 0
cpu cores       : 24
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 32
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpu
id aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibr
s ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm i
da arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities
vmx flags       : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs            : spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb rfds bhi
bogomips        : 5990.40
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Done.

_log.debug("Trying to determine ISA string on Linux via cmd '%s'", cmd)
res = run_shell_cmd(cmd, in_dry_run=True, hidden=True, fail_on_error=False, with_hooks=False,
output_file=False, stream_output=False)
if res.exit_code == EasyBuildExit.SUCCESS:
isa_string = res.output.strip()
else:
_log.debug("%s not found to determine ISA string", PROC_CPUINFO_FP)
else:
raise SystemToolsException("Could not determine ISA string (OS: %s)" % os_type)
return isa_string
Comment on lines 652 to 670
Copy link
Contributor

@Crivella Crivella Oct 31, 2025

Choose a reason for hiding this comment

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

I think raising an exception here will cause EB to fail on any non-LINUX systems, as the function calling this needs to always be resolved.

Maybe a cleaner solution would be to evaluate this at run-time instead of at the class declaration

Also i am wondering if defaulting to an empty string is the right thing to do.
This would cause -march= to be added causing some obfuscated failures while compiling.
Would it be better to fallback to something like the generic of rv64gc? The alternative would be to give a clear failure (but also would need a solution for the aforementioned problem of this function being called in the class declaration)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, you are right regarding the exception. I changed it by a _log.debug call.
As now the function will resolve anyway to rv64gc as fallback, I think it is fine to evaluate this at this point (mostly to be consistent with the rest of architectures)

Copy link
Member

Choose a reason for hiding this comment

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

FYI: I changed get_isa_riscv to return None on non-RISCV systems, mainly to avoid confusion



def get_gpu_info():
"""
Get the GPU info
Expand Down