+ GPU compute pipelines in pure Scala 3.
+ Run anywhere.
+
+ GPU programming with the expressiveness of Scala +
+{feature.description}
++ Write Scala. Execute on thousands of GPU cores. +
+++val normalize
=GFunction [Vec4 [Float32 ],Vec4 [Float32 ]]:{'\n'} +{' '}v
=>v
/length (v
){'\n'} +{'\n'} +val dot
=GFunction [Vec4 [Float32 ],Float32 ]:{'\n'} +{' '}v
=>v
dot (1f ,0f ,0f ,0f ) +
++val iterations
=GSeq {'\n'} +{' '}.gen (vec2 (0f ,0f ),z
=>{'\n'} +{' '}vec2 (z
.x
*z
.x
-z
.y
*z
.y
+cx
,2f *z
.x
*z
.y
+cy
)){'\n'} +{' '}.limit (256 ){'\n'} +{' '}.takeWhile (z
=>z
.x
*z
.x
+z
.y
*z
.y
<4f ){'\n'} +{' '}.count +
++case class Physics (gravity
:Float32 ,dt
:Float32 ){'\n'} +{' '}extends GStruct [Physics ]{'\n'} +{'\n'} +val step
=GFunction .forEachIndex [Physics ,Vec4 ,Vec4 ]:{'\n'} +{' '}(cfg
,i
,buf
) =>{'\n'} +{' '}val p
=buf
.read (i
){'\n'} +{' '}(p
.x
,p
.y
+cfg
.gravity
*cfg
.dt
,p
.z
,p
.w
) +
++for {'\n'} +{' '}value
=layout
.input
.read (idx
){'\n'} +{' '}_
<-layout
.bufferA
.write (idx
,value
+1f ){'\n'} +{' '}_
<-layout
.bufferB
.write (idx
,value
*2f ){'\n'} +yield value
+
++val pipeline
=GExecution [Int ,Layout ](){'\n'} +{' '}.addProgram (multiply
):{'\n'} +{' '}size
=>size
{'\n'} +{' '}l
=>MulLayout (l
.input
,l
.temp
,l
.mulParams
){'\n'} +{' '}.addProgram (add
):{'\n'} +{' '}size
=>size
{'\n'} +{' '}l
=>AddLayout (l
.temp
,l
.output
,l
.addParams
) +
++GBufferRegion {'\n'} +{' '}.allocate [MyLayout ]{'\n'} +{' '}.map :layout
=>{'\n'} +{' '}pipeline
.execute (params
,layout
){'\n'} +{' '}.runUnsafe ({'\n'} +{' '}init
=MyLayout (GBuffer (data
), ...),{'\n'} +{' '}onDone
=l
=>l
.output
.readArray (results
)) +
+ Real projects built with Cyfra +
+ ++ Ray-traced animations with reflections and shadows. The Foton library provides + a clean API for scenes, materials, and camera paths. +
+
+ + Real-time fluid dynamics on the GPU. Multi-stage pipeline solving + Navier-Stokes equations with pressure projection. +
+
+ + GPU-accelerated Fuzzy C-Means clustering integrated with fs2 streams. + Process 100k+ transactions/sec with live segment assignment. +
++ Neural network primitives on GPU. Matrix operations, activations, + and automatic differentiation in pure Scala. +
++ Any platform with Vulkan support +
++ Clone the repo, run the examples, and see what GPU programming in Scala feels like. +
+ + Read the Docs + +