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

Fix for setup issue on non-x86 platforms #191

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ The simplest way to get the new repo is to rerun the installation instructions b
#### Saving `Vector`´s in `MaMa` format
The `MaMa` format has some limitation. Mainly the format will not be able to save the `std` attribute, meaning that error-bars will not be stored. The `MaMa` format is always in keV units, meaning that the `units` keyword in the `Vector.save` method is ignored.

#### Compiling with `gcc` on macOS
Short answer: Don't. Please use `clang`.

## General usage
All the functions and classes in the package are available in the main module. You get everything by importing the package

Expand Down
1 change: 1 addition & 0 deletions release_note.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Changed:
- Fixed a bug where the `std` attribute of `Vector` was not saved to file.
- Reimplemented PPF for normal distribution and truncated normal distribution in C++ for improved performance (about 300% faster than the SciPy implementation!).
- Fixed a potential bug where `units` attribute is set erroniously when reading the discrete level density from file (`load_levels_discrete` and `load_levels_discrete_smooth`).
- Fixed a bug that prevented compilation on ARM platforms.

Deprecated:
- `shape` argument of Matrix for creation of a matrix filled with zeros. Use `ZerosMatrix` instead.
Expand Down
15 changes: 7 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,22 @@ def write_version_py(filename='ompy/version_setup.py'):
if os.path.exists(fname):
os.remove(fname)

extra_compile_args = ["-O3", "-ffast-math", "-march=native"]
extra_compile_args_cython = ["-O3", "-ffast-math"]
extra_compile_args_cpp = ["-std=c++11", "-O3"]

extra_link_args = []
if openmp and platform.system() == 'Darwin':
extra_compile_args.insert(-1, "-Xpreprocessor -fopenmp")
extra_compile_args_cython.insert(-1, "-Xpreprocessor -fopenmp")
extra_link_args.insert(-1, "-lomp")
elif openmp:
extra_compile_args.insert(-1, "-fopenmp")
extra_compile_args_cython.insert(-1, "-fopenmp")
extra_link_args.insert(-1, "-fopenmp")

ext_modules = [
Extension("ompy.decomposition",
["ompy/decomposition.pyx"],
# on MacOS the clang compiler pretends not to support OpenMP, but in fact it does so
extra_compile_args=extra_compile_args,
extra_compile_args=extra_compile_args_cython,
extra_link_args=extra_link_args,
include_dirs=[numpy.get_include()]
),
Expand All @@ -155,9 +157,7 @@ def write_version_py(filename='ompy/version_setup.py'):
ext_modules_pybind11 = [
Pybind11Extension("ompy.stats",
["src/stats.cpp"],
extra_compile_args=["-std=c++11", "-mfpmath=sse",
"-O3", "-funroll-loops",
"-march=native"])
extra_compile_args=extra_compile_args_cpp)
]

install_requires = [
Expand Down Expand Up @@ -190,4 +190,3 @@ def write_version_py(filename='ompy/version_setup.py'):
zip_safe=False,
install_requires=install_requires
)