2023-09-27 13:10:40 +00:00
|
|
|
#include "../squiggle.h"
|
2023-11-27 14:13:50 +00:00
|
|
|
#include "../squiggle_more.h"
|
2023-09-27 13:10:40 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// set randomness seed
|
|
|
|
uint64_t* seed = malloc(sizeof(uint64_t));
|
|
|
|
*seed = 1000; // xorshift can't start with a seed of 0
|
2023-11-18 23:54:31 +00:00
|
|
|
/*
|
2023-09-27 13:10:40 +00:00
|
|
|
for (int i = 0; i < 100; i++) {
|
|
|
|
double draw = sample_unit_uniform(seed);
|
|
|
|
printf("%f\n", draw);
|
|
|
|
|
2023-11-18 23:54:31 +00:00
|
|
|
}*/
|
|
|
|
// Test division
|
2023-11-27 14:13:50 +00:00
|
|
|
// printf("\n%d\n", 10 % 3);
|
|
|
|
//
|
|
|
|
|
|
|
|
int n_samples = 100, n_threads = 16;
|
|
|
|
double* results = malloc(n_samples * sizeof(double));
|
|
|
|
double sampler_scratchpad(uint64_t* seed){
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
parallel_sampler(sampler_scratchpad, results, n_threads, n_samples);
|
|
|
|
for(int i=0; i<n_samples; i++){
|
|
|
|
printf("Sample %d: %f\n", i, results[i]);
|
|
|
|
}
|
2023-09-27 13:10:40 +00:00
|
|
|
|
|
|
|
free(seed);
|
|
|
|
}
|