This file contains hidden or 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
| use num_traits; | |
| use numpy::{npyffi, DataType, PyArray, PyArray1, PyArrayDyn}; | |
| use pyo3::prelude::*; | |
| use pyo3::{exceptions::PyValueError, AsPyPointer, PyDowncastError, PyResult}; | |
| //based on https://github.com/aleksander-mendoza/RustyNEAT/blob/42508c84d4564461067927fd1afb0db538a442fe/pylib/src/py_ndalgebra.rs#L763 | |
| #[pyfunction] | |
| pub fn generic_test(input: &PyAny) -> PyResult<PyObject> { | |
| let (dtype, shape) = pick_array_info(input)?; |
This file contains hidden or 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
| #include <cuda.h> | |
| #include <curand.h> | |
| #include <curand_kernel.h> | |
| #define NTRIANGLES 20 // númetro de triângulos para desenhar cada círculo | |
| #define RAIO_M1 0.001f // tamanho do raio para massa = 1 u | |
| #define TIMESTEP_MS 50 // tempo entre os callbacks | |
| #define G 0.00000005f // constante gravitacional fictícia | |
| __device__ void generate_triangles(float2 pos, float m, |
This file contains hidden or 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 numpy as np | |
| from multiprocessing import Process, Manager, Value, Array | |
| import time | |
| import humanize | |
| #actual computation | |
| def f(a): | |
| return a-1.0; | |
| # obs: with such a simple computation, there will advantage will be no computation time advantage. |