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

DM-32487: Adjust flags and tests to support osx-arm64 #203

Merged
merged 2 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/SConscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# -*- python -*-
from lsst.sconsUtils import scripts, targets, env
import os

for flag in ("-fexceptions", "-DNSUPERNODAL", "-DNPARTITION"):

flags = ["-fexceptions", "-DNSUPERNODAL", "-DNPARTITION"]

uname = os.uname()
if uname.sysname == 'Darwin' and uname.machine == 'arm64':
flags.append('-faligned-allocation')
Copy link
Member

Choose a reason for hiding this comment

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

Is there a down side to using that on intel macOS as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it ain't broke...
But I don't know.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like it's only available for C++17 compilers.

-faligned-allocation    Enable C++17 aligned allocation functions

We are meant to be using C++17 these days but this is presumably fall out from us insisting on using an old macOS deployment target on Intel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, a little more research (and as noted in the ticket description) I think that the deployment target that we have as a default on x86 will make this impossible to have as the universal default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Enabling C++17 compilation doesn't necessarily enable library support for it. MacOSx way to be backwards
compatible with old deployment targets.


for flag in flags:
env["CFLAGS"].append(flag)
env["CXXFLAGS"].append(flag)

Expand Down
9 changes: 6 additions & 3 deletions tests/test_star.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ def test_apply_one(self):
self.assertEqual(self.ra.to_value(u.degree)*0.01, self.star.vx)
self.assertEqual(self.dec.to_value(u.degree)*0.01, self.star.vy)

# 1e-9 deg == 3.6 microarcsec; that's pretty good accuracy over a 100 year baseline.
self.assertFloatsAlmostEqual(result.x, expect.ra.to_value(u.degree), rtol=1e-9)
self.assertFloatsAlmostEqual(result.y, expect.dec.to_value(u.degree), rtol=1e-9)
# 5e-8 deg == 180 microarcsec over a 100 year baseline.
# The precision here is driven by differences in astropy coord.apply_space_motion()
# for different architectures; the computation of refStar.applyProperMotion does
# not depend on architecture to full double precision.
self.assertFloatsAlmostEqual(result.x, expect.ra.to_value(u.degree), rtol=5e-8)
self.assertFloatsAlmostEqual(result.y, expect.dec.to_value(u.degree), rtol=5e-8)
# TODO? astropy SkyCoord does not include coordinate errors, or error propogation.
# How do I test it?
# self.assertEqual(result.vx, expect.vx)
Expand Down