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

Add extra build flag 'HOROVOD_BUILD_ARCH_FLAGS' #1751

Merged
merged 2 commits into from
Mar 2, 2020

Conversation

nvcastet
Copy link
Collaborator

Add env variable to specify architecture-specific compiler flags.
For example, to be compatible with the older CPU architecture 'Sandy Bridge' and tune for 'Broadwell':
HOROVOD_BUILD_ARCH_FLAGS="-march=sandybridge -mtune=broadwell" ... pip install horovod

Signed-off-by: Nicolas V Castet nvcastet@us.ibm.com

setup.py Outdated
@@ -118,7 +118,8 @@ def get_supported_instruction_set_flags(flags_to_check):
def get_cpp_flags(build_ext):
last_err = None
default_flags = ['-std=c++11', '-fPIC', '-O2', '-Wall', '-fassociative-math', '-ffast-math', '-ftree-vectorize', '-funsafe-math-optimizations']
avx_fma_flags = get_supported_instruction_set_flags(['-mf16c', '-mavx', '-mfma'])
avx_env_vars = os.environ.get('HOROVOD_BUILD_ARCH_FLAGS')
avx_fma_flags = get_supported_instruction_set_flags(['-mf16c', '-mavx', '-mfma']) if avx_env_vars is None else avx_env_vars.split()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good to me but I wonder if we should rename these variables to something more generic, like avx_env_vars -> build_arch_flags_env and avx_fma_flags -> build_arch_flags?

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1, looks great, I think making the variable names consistent with the environment variable is a good idea.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch

Add env variable to specify architecture-specific compiler flags.
For example, to be compatible with the older CPU architecture 'Sandy Bridge' and tune for 'Broadwell':
HOROVOD_BUILD_ARCH_FLAGS="-march=sandybridge -mtune=broadwell" ... pip install horovod

Signed-off-by: Nicolas V Castet <nvcastet@us.ibm.com>
Signed-off-by: Nicolas V Castet <nvcastet@us.ibm.com>
Copy link
Collaborator

@tgaddair tgaddair left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the quick fix.

@tgaddair tgaddair merged commit cff4de3 into horovod:master Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants