https://github.com/brandondube/goray

https://github.com/brandondube/goray

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.8%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: brandondube
  • License: mit
  • Language: Go
  • Default Branch: main
  • Size: 22.5 KB
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Created over 4 years ago · Last pushed over 3 years ago
Metadata Files
Readme License

README.md

goray

Goray is a repository craeted to evaluate how fast Go can perform raytracing. It contains a specialized linear algebra package for the 3-vectors and square 3-matricies needed for real ray tracing, as well as a basic implementation of planar and conic geometry. The code wasn't extensively checked to be free of bugs, but was written in around half an hour, based on prysm's experimental raytrace module.

Overall, the performance of Go in this regime is quite good, and the type system lends itself reasonably well to the task. The summary benchmark result, to trace a two-surface conic+planar geometry:

goos: windows goarch: amd64 pkg: github.com/brandondube/goray cpu: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz BenchmarkRayTrace-8 3663687 326.4 ns/op 160 B/op 2 allocs/op BenchmarkRaytraceNoAlloc-8 4386572 275.8 ns/op 0 B/op 0 allocs/op BenchmarkParallelRaytrace1Thread1Mray-8 4 278530150 ns/op 208 B/op 3 allocs/op BenchmarkParallelRaytrace2Thread1Mray-8 8 141101462 ns/op 504 B/op 5 allocs/op BenchmarkParallelRaytrace3Thread1Mray-8 12 94838375 ns/op 808 B/op 7 allocs/op BenchmarkParallelRaytrace4Thread1Mray-8 15 71159467 ns/op 1372 B/op 10 allocs/op BenchmarkParallelRaytrace5Thread1Mray-8 20 58274915 ns/op 1526 B/op 12 allocs/op BenchmarkParallelRaytrace6Thread1Mray-8 24 48336904 ns/op 1480 B/op 13 allocs/op BenchmarkParallelRaytrace7Thread1Mray-8 24 41895525 ns/op 2036 B/op 16 allocs/op BenchmarkParallelRaytrace8Thread1Mray-8 31 41124787 ns/op 2611 B/op 19 allocs/op

This works out to about 150 nanoseconds per surface, or 6.6 million ray-surfaces per second (per core). Using 8 cores results in an equivalent sequential speed of about 21 nanoseconds per ray-surface, 48 million ray-surfaces per second. That number is roughly half the speed of Code V.

I suspect commercial raytracers specialize the surface intersection operation, which is about 75% of the runtime, for low-complexity surfaces like spheres. The surface sag and normal are evaluted three times for Newton's method, and so to an order of magnitude 50% of the runtime can be shaved off by a closed form surface intersection function.

Adjusting the oneM constant in the test file lets you quickly change the batch size. At 1,000 total rays (125 rays per thread) the overhead of spawning the goroutines is almost doubling the runtime (i.e., instead of 41 ns per ray, ~72 ns per ray).

I don't particularly intend to develop this further, but it was an interesting exercise.

Owner

  • Name: Brandon Dube
  • Login: brandondube
  • Kind: user
  • Location: Pasadena, CA
  • Company: @NASA-JPL

Make numerical optics fast and accessible

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
proxy.golang.org: github.com/brandondube/goray
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 10 months ago