Created
November 29, 2022 00:03
-
-
Save michaelchughes/363f9bf62631dfa37fbf1f402d975f56 to your computer and use it in GitHub Desktop.
Simple script that verifies JAX has access to GPU and can do basic ops (matrix multiply)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jax | |
import jax.numpy as jnp | |
if __name__ == '__main__': | |
print("jax.devices()") | |
print(jax.devices()) | |
a = jnp.asarray([[1.0, 2.0, 3.0], [4., 5., 6.]]) | |
b = jnp.asarray([[1.0, 2.0], [3.0, 4.0], [5., 6.]]) | |
print("Array 'a':") | |
print(a) | |
print("Array 'b':") | |
print(b) | |
print("where do the arrays live?") | |
print(a.device_buffer.device()) | |
print("Result of jnp.dot(a,b)") | |
c = jnp.dot(a,b) | |
print(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment