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

Inconsistency in results between MacOS and Ubuntu #185

Closed
jchamilton75 opened this issue Mar 20, 2024 · 13 comments
Closed

Inconsistency in results between MacOS and Ubuntu #185

jchamilton75 opened this issue Mar 20, 2024 · 13 comments

Comments

@jchamilton75
Copy link

Hi everyone,

TLDR:
We installed NaMaster with the same virtual environment (using micromamba and conda-forge packages) on a M1 mac (same with M2) and an Ubuntu Linux and got very different results from NaMaster.

We finally succeeded installing Namaster on a mac M1 using a micromamba virtual environment. It went on very smoothly. We did the same installation on a Linux Ubuntu.

Then comparing the results of a simple test code provided in NaMaster (Example 6: Pure E and B) with just a few prints added and a forced seed in the Monte-Carlo so that we had the same seed on both machines.

The results found are absurd with the mac and seem as expected with Linux. Very frustrating...

Both notebooks are available with their outputs on https://gist.github.com/jchamilton75/11bacae57a042361b38e450c3c2e8f4f

We tried the same on a M2 and obtained the same as with the M1.

Any insight ?

Thanks in advance !

@gfabbian
Copy link

gfabbian commented May 9, 2024

I am seeing the same thing for M3 chips and independently found analogous (or worse results). I did try set input E-modes to 0 but still recover crazy B-modes spectra regardless. In the attached plot an example of the result, where theory in the error bar is the usual Gaussian "fsky-approximated" error bar.
Note that problem also affects E-modes even if only B-modes are purified.

For reference, also compiling from source didn't fix the problem so it is probably not a conda package problem.
Screenshot 2024-05-09 at 20 33 07

@damonge
Copy link
Collaborator

damonge commented Jun 7, 2024

Could you try installing the latest version currently on conda (v2)? I'm hoping that any issues with the new Mac chips are now gone.

@gfabbian
Copy link

gfabbian commented Jun 8, 2024

Sadly I'm seeing consistent results even with V2 (the variance is slightly worse)

Screenshot 2024-06-08 at 15 15 29

@damonge
Copy link
Collaborator

damonge commented Jun 9, 2024

OK, thanks a lot.

The fact that this still happens with the newer version narrows it down, I think. Most of the code is completely different, so this can only be coming from a couple of things. I'm trying to test this on my own without a mac, but in the meantime, can I check:

  • Does this only happen with purification, and otherwise the code works as expected?
  • If the answer above is yes, can you check if the two apodised masks (generated in linux or mac) are the same?

@damonge
Copy link
Collaborator

damonge commented Jun 10, 2024

@fjaviersanchez is not able to reproduce this with a fresh install from conda. His setup is:

  • M2 chip

  • healpy version: '1.16.6' , numpy version: '1.26.4', pymaster version: 2.0

@gfabbian can I check how this differs from yours?

@damonge
Copy link
Collaborator

damonge commented Jun 10, 2024

(also, just to check, you are indeed installing from conda, correct?)

@fjaviersanchez
Copy link
Collaborator

For more context, this is the recipe I followed to install the package:

conda create -n namaster2 namaster -c conda-forge
conda activate namaster2
conda install healpy -c conda-forge

I can play a bit with the numpy and healpy versions to see if those are responsible.

@gfabbian
Copy link

@fjaviersanchez are you using conda with osx-arm64 platform or osx-64?

I have the same numpy/healpy as yours and see the issue even when creating a new environment :(. I also confirm issues show up in purification. Happy to rerun any test code you have. I can also send out a notebook if useful.

@fjaviersanchez
Copy link
Collaborator

Hmm, I just checked and this is my conda info:

platform : osx-arm64

I am using python 3.12. I haven't checked with 3.11 though, and I know that some people had issues with 3.11 with other packages. I can check!

@gfabbian
Copy link

I believe the only thing different at this point is the chip as I also have python 3.12.

@damonge
Copy link
Collaborator

damonge commented Jun 13, 2024

Humm, but @jchamilton75 said he was using an M2 above...

@gfabbian
Copy link

@jchamilton75 can you confirm if you see the problem with a fresh environment installation?

@damonge
Copy link
Collaborator

damonge commented Jun 14, 2024

After further offline iterations with @gfabbian (thanks so much for this @gfabbian ), it seems the issue was conflicting old versions of ducc0 installed via pip. When installing all packages consistently from conda the problem disappears (@gfabbian please correct me if what I just said is inaccurate).

I'll close this for now, but feel free to reopen if the issue reappears.

@damonge damonge closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants