|
2 | 2 | Created at 10.12.2019 |
3 | 3 | """ |
4 | 4 |
|
5 | | -import numpy as np |
6 | 5 | import ThrustRTC as trtc |
7 | | -import CURandRTC as rndrtc |
8 | 6 | from ._storage_methods import StorageMethods |
9 | 7 | from PySDM.backends.thrustRTC.nice_thrust import nice_thrust |
10 | 8 | from PySDM.backends.thrustRTC.conf import NICE_THRUST_FLAGS |
@@ -119,31 +117,3 @@ def power(output, exponent): |
119 | 117 | @nice_thrust(**NICE_THRUST_FLAGS) |
120 | 118 | def subtract(output, subtrahend): |
121 | 119 | MathsMethods.__subtract_body.launch_n(output.size(), [output, subtrahend]) |
122 | | - # trtc.Transform_Binary(output, subtrahend, output, trtc.Minus()) |
123 | | - |
124 | | - __urand_init_rng_state_body = trtc.For(['rng', 'states', 'seed'], 'i', ''' |
125 | | - rng.state_init(1234, i, 0, states[i]); |
126 | | - ''') |
127 | | - |
128 | | - __urand_body = trtc.For(['states', 'vec_rnd'], 'i', ''' |
129 | | - vec_rnd[i]=states[i].rand01(); |
130 | | - ''') |
131 | | - |
132 | | - __rng = rndrtc.DVRNG() |
133 | | - states = trtc.device_vector('RNGState', 2**19) |
134 | | - __urand_init_rng_state_body.launch_n(states.size(), [__rng, states, trtc.DVInt64(12)]) |
135 | | - |
136 | | - @staticmethod |
137 | | - @nice_thrust(**NICE_THRUST_FLAGS) |
138 | | - def urand(data, seed=None): |
139 | | - # TODO: print("Numpy import!: ThrustRTC.urand(...)") |
140 | | - |
141 | | - seed = seed or np.random.randint(2**16) |
142 | | - dseed = trtc.DVInt64(seed) |
143 | | - # MathsMethods.__urand_init_rng_state_body.launch_n(MathsMethods.states.size(), [MathsMethods.__rng, MathsMethods.states, dseed]) |
144 | | - MathsMethods.__urand_body.launch_n(data.size(), [MathsMethods.states, data]) |
145 | | - # hdata = data.to_host() |
146 | | - # print(np.mean(hdata)) |
147 | | - # np.random.seed(seed) |
148 | | - # output = np.random.uniform(0, 1, data.shape) |
149 | | - # StorageMethods.upload(output, data) |
0 commit comments