Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "cuda_runtime.h"
- #include "device_launch_parameters.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- __global__ void mykernel(void) {
- }
- __global__ void addKernel(int* c, const int* a, const int* b) {
- int i = threadIdx.x;
- c[i] = a[i] + b[i];
- }
- float f(float x) {
- return 0,25 * x * x;
- }
- void parallel_monte_carlo_integrate(int R, float* result) {
- srand(time(NULL));
- float w = 1 / R;
- int i = 0;
- int x = (rand() / RAND_MAX + i * w) / R;
- int y = rand() / RAND_MAX;
- printf("x=%lf", x);
- }
- int main(void) {
- parallel_monte_carlo_integrate(1, 0);
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement