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

Comparing photon states produced with CPU and GPU pipelines #30

Open
plexoos opened this issue Sep 27, 2024 · 5 comments
Open

Comparing photon states produced with CPU and GPU pipelines #30

plexoos opened this issue Sep 27, 2024 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@plexoos
Copy link
Member

plexoos commented Sep 27, 2024

Example command:

build/src/simg4ox -g esi-g4ox/geom/raindrop.gdml -m esi-g4ox/run.mac

Assuming the environment variables:

export TMP=/tmp/myname
export GEOM=mygeom
export OPTICKS_EVENT_MODE=DebugHeavy

the output is saved to /tmp/myname/GEOM/mygeom/simg4ox/ALL0/

  • AXXX folder contains GPU results
  • BXXX folder contains (Geant4) CPU results
import opticks.sysrap.sevt as s
a = s.SEvt.Load("/tmp/myname/GEOM/mygeom/simg4ox/ALL0/A000/")
b = s.SEvt.Load("/tmp/myname/GEOM/mygeom/simg4ox/ALL0/B000/")
a.f.record
b.f.record

Issue: Initial photon states are not included in the CPU output (?)

@plexoos plexoos added the documentation Improvements or additions to documentation label Sep 27, 2024
@plexoos
Copy link
Member Author

plexoos commented Sep 27, 2024

I think we should have a test comparing the CPU and GPU outputs. It would help significantly with debugging and refactoring.

In [16]: np.allclose(a.f.record[0,1:4], b.f.record[0,0:3])
Out[16]: True

In [17]: (a.f.record[0,1:4] == b.f.record[0,0:3]).all()
Out[17]: False

@buddhasystem
Copy link

I think we should have a test comparing the CPU and GPU outputs. It would help significantly with debugging and refactoring.

In [16]: np.allclose(a.f.record[0,1:4], b.f.record[0,0:3])
Out[16]: True

In [17]: (a.f.record[0,1:4] == b.f.record[0,0:3]).all()
Out[17]: False

Do you expect absolute precision? There are Python methods that allow you to define the precision in tests like this one.

@plexoos
Copy link
Member Author

plexoos commented Sep 27, 2024

No, I don't expect identical results for floating point numbers. The numpy's allclose function has reasonable defaults but can be tweaked if necessary.

@buddhasystem
Copy link

Right on...

@plexoos
Copy link
Member Author

plexoos commented Oct 1, 2024

A test comparing photon states produced with CPU and GPU pipelines is implemented in #31
8 out of 100 photons have different histories but the values seem to be reproducible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants