cudarc 0.19.4

Safe and minimal CUDA bindings
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
#![cfg_attr(feature = "no-std", no_std)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#[cfg(feature = "no-std")]
extern crate alloc;
#[cfg(feature = "no-std")]
extern crate no_std_compat as std;
pub use self::curandDirectionVectorSet as curandDirectionVectorSet_t;
pub use self::curandMethod as curandMethod_t;
pub use self::curandOrdering as curandOrdering_t;
pub use self::curandRngType as curandRngType_t;
pub use self::curandStatus as curandStatus_t;
pub use self::libraryPropertyType_t as libraryPropertyType;
pub type cudaStream_t = *mut CUstream_st;
pub type curandDirectionVectors32_t = [::core::ffi::c_uint; 32usize];
pub type curandDirectionVectors64_t = [::core::ffi::c_ulonglong; 64usize];
pub type curandDiscreteDistribution_t = *mut curandDiscreteDistribution_st;
pub type curandDistributionM2Shift_t = *mut curandDistributionM2Shift_st;
pub type curandDistributionShift_t = *mut curandDistributionShift_st;
pub type curandDistribution_st = f64;
pub type curandDistribution_t = *mut curandDistribution_st;
pub type curandGenerator_t = *mut curandGenerator_st;
pub type curandHistogramM2K_st = ::core::ffi::c_uint;
pub type curandHistogramM2K_t = *mut curandHistogramM2K_st;
pub type curandHistogramM2V_st = curandDistribution_st;
pub type curandHistogramM2V_t = *mut curandHistogramM2V_st;
pub type curandHistogramM2_t = *mut curandHistogramM2_st;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub enum curandDirectionVectorSet {
    CURAND_DIRECTION_VECTORS_32_JOEKUO6 = 101,
    CURAND_SCRAMBLED_DIRECTION_VECTORS_32_JOEKUO6 = 102,
    CURAND_DIRECTION_VECTORS_64_JOEKUO6 = 103,
    CURAND_SCRAMBLED_DIRECTION_VECTORS_64_JOEKUO6 = 104,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub enum curandMethod {
    CURAND_CHOOSE_BEST = 0,
    CURAND_ITR = 1,
    CURAND_KNUTH = 2,
    CURAND_HITR = 3,
    CURAND_M1 = 4,
    CURAND_M2 = 5,
    CURAND_BINARY_SEARCH = 6,
    CURAND_DISCRETE_GAUSS = 7,
    CURAND_REJECTION = 8,
    CURAND_DEVICE_API = 9,
    CURAND_FAST_REJECTION = 10,
    CURAND_3RD = 11,
    CURAND_DEFINITION = 12,
    CURAND_POISSON = 13,
}
#[cfg(any(feature = "cuda-11040"))]
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub enum curandOrdering {
    CURAND_ORDERING_PSEUDO_BEST = 100,
    CURAND_ORDERING_PSEUDO_DEFAULT = 101,
    CURAND_ORDERING_PSEUDO_SEEDED = 102,
    CURAND_ORDERING_PSEUDO_LEGACY = 103,
    CURAND_ORDERING_QUASI_DEFAULT = 201,
}
#[cfg(any(
    feature = "cuda-11050",
    feature = "cuda-11060",
    feature = "cuda-11070",
    feature = "cuda-11080",
    feature = "cuda-12000",
    feature = "cuda-12010",
    feature = "cuda-12020",
    feature = "cuda-12030",
    feature = "cuda-12040",
    feature = "cuda-12050",
    feature = "cuda-12060",
    feature = "cuda-12080",
    feature = "cuda-12090",
    feature = "cuda-13000",
    feature = "cuda-13010",
    feature = "cuda-13020"
))]
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub enum curandOrdering {
    CURAND_ORDERING_PSEUDO_BEST = 100,
    CURAND_ORDERING_PSEUDO_DEFAULT = 101,
    CURAND_ORDERING_PSEUDO_SEEDED = 102,
    CURAND_ORDERING_PSEUDO_LEGACY = 103,
    CURAND_ORDERING_PSEUDO_DYNAMIC = 104,
    CURAND_ORDERING_QUASI_DEFAULT = 201,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub enum curandRngType {
    CURAND_RNG_TEST = 0,
    CURAND_RNG_PSEUDO_DEFAULT = 100,
    CURAND_RNG_PSEUDO_XORWOW = 101,
    CURAND_RNG_PSEUDO_MRG32K3A = 121,
    CURAND_RNG_PSEUDO_MTGP32 = 141,
    CURAND_RNG_PSEUDO_MT19937 = 142,
    CURAND_RNG_PSEUDO_PHILOX4_32_10 = 161,
    CURAND_RNG_QUASI_DEFAULT = 200,
    CURAND_RNG_QUASI_SOBOL32 = 201,
    CURAND_RNG_QUASI_SCRAMBLED_SOBOL32 = 202,
    CURAND_RNG_QUASI_SOBOL64 = 203,
    CURAND_RNG_QUASI_SCRAMBLED_SOBOL64 = 204,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub enum curandStatus {
    CURAND_STATUS_SUCCESS = 0,
    CURAND_STATUS_VERSION_MISMATCH = 100,
    CURAND_STATUS_NOT_INITIALIZED = 101,
    CURAND_STATUS_ALLOCATION_FAILED = 102,
    CURAND_STATUS_TYPE_ERROR = 103,
    CURAND_STATUS_OUT_OF_RANGE = 104,
    CURAND_STATUS_LENGTH_NOT_MULTIPLE = 105,
    CURAND_STATUS_DOUBLE_PRECISION_REQUIRED = 106,
    CURAND_STATUS_LAUNCH_FAILURE = 201,
    CURAND_STATUS_PREEXISTING_FAILURE = 202,
    CURAND_STATUS_INITIALIZATION_FAILED = 203,
    CURAND_STATUS_ARCH_MISMATCH = 204,
    CURAND_STATUS_INTERNAL_ERROR = 999,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub enum libraryPropertyType_t {
    MAJOR_VERSION = 0,
    MINOR_VERSION = 1,
    PATCH_LEVEL = 2,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUstream_st {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct curandDiscreteDistribution_st {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct curandDistributionM2Shift_st {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct curandDistributionShift_st {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct curandGenerator_st {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct curandHistogramM2_st {
    _unused: [u8; 0],
}
#[cfg(not(feature = "dynamic-loading"))]
extern "C" {
    pub fn curandCreateGenerator(
        generator: *mut curandGenerator_t,
        rng_type: curandRngType_t,
    ) -> curandStatus_t;
    pub fn curandCreateGeneratorHost(
        generator: *mut curandGenerator_t,
        rng_type: curandRngType_t,
    ) -> curandStatus_t;
    pub fn curandCreatePoissonDistribution(
        lambda: f64,
        discrete_distribution: *mut curandDiscreteDistribution_t,
    ) -> curandStatus_t;
    pub fn curandDestroyDistribution(
        discrete_distribution: curandDiscreteDistribution_t,
    ) -> curandStatus_t;
    pub fn curandDestroyGenerator(generator: curandGenerator_t) -> curandStatus_t;
    pub fn curandGenerate(
        generator: curandGenerator_t,
        outputPtr: *mut ::core::ffi::c_uint,
        num: usize,
    ) -> curandStatus_t;
    pub fn curandGenerateLogNormal(
        generator: curandGenerator_t,
        outputPtr: *mut f32,
        n: usize,
        mean: f32,
        stddev: f32,
    ) -> curandStatus_t;
    pub fn curandGenerateLogNormalDouble(
        generator: curandGenerator_t,
        outputPtr: *mut f64,
        n: usize,
        mean: f64,
        stddev: f64,
    ) -> curandStatus_t;
    pub fn curandGenerateLongLong(
        generator: curandGenerator_t,
        outputPtr: *mut ::core::ffi::c_ulonglong,
        num: usize,
    ) -> curandStatus_t;
    pub fn curandGenerateNormal(
        generator: curandGenerator_t,
        outputPtr: *mut f32,
        n: usize,
        mean: f32,
        stddev: f32,
    ) -> curandStatus_t;
    pub fn curandGenerateNormalDouble(
        generator: curandGenerator_t,
        outputPtr: *mut f64,
        n: usize,
        mean: f64,
        stddev: f64,
    ) -> curandStatus_t;
    pub fn curandGeneratePoisson(
        generator: curandGenerator_t,
        outputPtr: *mut ::core::ffi::c_uint,
        n: usize,
        lambda: f64,
    ) -> curandStatus_t;
    pub fn curandGeneratePoissonMethod(
        generator: curandGenerator_t,
        outputPtr: *mut ::core::ffi::c_uint,
        n: usize,
        lambda: f64,
        method: curandMethod_t,
    ) -> curandStatus_t;
    pub fn curandGenerateSeeds(generator: curandGenerator_t) -> curandStatus_t;
    pub fn curandGenerateUniform(
        generator: curandGenerator_t,
        outputPtr: *mut f32,
        num: usize,
    ) -> curandStatus_t;
    pub fn curandGenerateUniformDouble(
        generator: curandGenerator_t,
        outputPtr: *mut f64,
        num: usize,
    ) -> curandStatus_t;
    pub fn curandGetDirectionVectors32(
        vectors: *mut *mut curandDirectionVectors32_t,
        set: curandDirectionVectorSet_t,
    ) -> curandStatus_t;
    pub fn curandGetDirectionVectors64(
        vectors: *mut *mut curandDirectionVectors64_t,
        set: curandDirectionVectorSet_t,
    ) -> curandStatus_t;
    pub fn curandGetProperty(
        type_: libraryPropertyType,
        value: *mut ::core::ffi::c_int,
    ) -> curandStatus_t;
    pub fn curandGetScrambleConstants32(constants: *mut *mut ::core::ffi::c_uint)
        -> curandStatus_t;
    pub fn curandGetScrambleConstants64(
        constants: *mut *mut ::core::ffi::c_ulonglong,
    ) -> curandStatus_t;
    pub fn curandGetVersion(version: *mut ::core::ffi::c_int) -> curandStatus_t;
    pub fn curandSetGeneratorOffset(
        generator: curandGenerator_t,
        offset: ::core::ffi::c_ulonglong,
    ) -> curandStatus_t;
    pub fn curandSetGeneratorOrdering(
        generator: curandGenerator_t,
        order: curandOrdering_t,
    ) -> curandStatus_t;
    pub fn curandSetPseudoRandomGeneratorSeed(
        generator: curandGenerator_t,
        seed: ::core::ffi::c_ulonglong,
    ) -> curandStatus_t;
    pub fn curandSetQuasiRandomGeneratorDimensions(
        generator: curandGenerator_t,
        num_dimensions: ::core::ffi::c_uint,
    ) -> curandStatus_t;
    pub fn curandSetStream(generator: curandGenerator_t, stream: cudaStream_t) -> curandStatus_t;
}
#[cfg(feature = "dynamic-loading")]
mod loaded {
    use super::*;
    pub unsafe fn curandCreateGenerator(
        generator: *mut curandGenerator_t,
        rng_type: curandRngType_t,
    ) -> curandStatus_t {
        (culib().curandCreateGenerator)(generator, rng_type)
    }
    pub unsafe fn curandCreateGeneratorHost(
        generator: *mut curandGenerator_t,
        rng_type: curandRngType_t,
    ) -> curandStatus_t {
        (culib().curandCreateGeneratorHost)(generator, rng_type)
    }
    pub unsafe fn curandCreatePoissonDistribution(
        lambda: f64,
        discrete_distribution: *mut curandDiscreteDistribution_t,
    ) -> curandStatus_t {
        (culib().curandCreatePoissonDistribution)(lambda, discrete_distribution)
    }
    pub unsafe fn curandDestroyDistribution(
        discrete_distribution: curandDiscreteDistribution_t,
    ) -> curandStatus_t {
        (culib().curandDestroyDistribution)(discrete_distribution)
    }
    pub unsafe fn curandDestroyGenerator(generator: curandGenerator_t) -> curandStatus_t {
        (culib().curandDestroyGenerator)(generator)
    }
    pub unsafe fn curandGenerate(
        generator: curandGenerator_t,
        outputPtr: *mut ::core::ffi::c_uint,
        num: usize,
    ) -> curandStatus_t {
        (culib().curandGenerate)(generator, outputPtr, num)
    }
    pub unsafe fn curandGenerateLogNormal(
        generator: curandGenerator_t,
        outputPtr: *mut f32,
        n: usize,
        mean: f32,
        stddev: f32,
    ) -> curandStatus_t {
        (culib().curandGenerateLogNormal)(generator, outputPtr, n, mean, stddev)
    }
    pub unsafe fn curandGenerateLogNormalDouble(
        generator: curandGenerator_t,
        outputPtr: *mut f64,
        n: usize,
        mean: f64,
        stddev: f64,
    ) -> curandStatus_t {
        (culib().curandGenerateLogNormalDouble)(generator, outputPtr, n, mean, stddev)
    }
    pub unsafe fn curandGenerateLongLong(
        generator: curandGenerator_t,
        outputPtr: *mut ::core::ffi::c_ulonglong,
        num: usize,
    ) -> curandStatus_t {
        (culib().curandGenerateLongLong)(generator, outputPtr, num)
    }
    pub unsafe fn curandGenerateNormal(
        generator: curandGenerator_t,
        outputPtr: *mut f32,
        n: usize,
        mean: f32,
        stddev: f32,
    ) -> curandStatus_t {
        (culib().curandGenerateNormal)(generator, outputPtr, n, mean, stddev)
    }
    pub unsafe fn curandGenerateNormalDouble(
        generator: curandGenerator_t,
        outputPtr: *mut f64,
        n: usize,
        mean: f64,
        stddev: f64,
    ) -> curandStatus_t {
        (culib().curandGenerateNormalDouble)(generator, outputPtr, n, mean, stddev)
    }
    pub unsafe fn curandGeneratePoisson(
        generator: curandGenerator_t,
        outputPtr: *mut ::core::ffi::c_uint,
        n: usize,
        lambda: f64,
    ) -> curandStatus_t {
        (culib().curandGeneratePoisson)(generator, outputPtr, n, lambda)
    }
    pub unsafe fn curandGeneratePoissonMethod(
        generator: curandGenerator_t,
        outputPtr: *mut ::core::ffi::c_uint,
        n: usize,
        lambda: f64,
        method: curandMethod_t,
    ) -> curandStatus_t {
        (culib().curandGeneratePoissonMethod)(generator, outputPtr, n, lambda, method)
    }
    pub unsafe fn curandGenerateSeeds(generator: curandGenerator_t) -> curandStatus_t {
        (culib().curandGenerateSeeds)(generator)
    }
    pub unsafe fn curandGenerateUniform(
        generator: curandGenerator_t,
        outputPtr: *mut f32,
        num: usize,
    ) -> curandStatus_t {
        (culib().curandGenerateUniform)(generator, outputPtr, num)
    }
    pub unsafe fn curandGenerateUniformDouble(
        generator: curandGenerator_t,
        outputPtr: *mut f64,
        num: usize,
    ) -> curandStatus_t {
        (culib().curandGenerateUniformDouble)(generator, outputPtr, num)
    }
    pub unsafe fn curandGetDirectionVectors32(
        vectors: *mut *mut curandDirectionVectors32_t,
        set: curandDirectionVectorSet_t,
    ) -> curandStatus_t {
        (culib().curandGetDirectionVectors32)(vectors, set)
    }
    pub unsafe fn curandGetDirectionVectors64(
        vectors: *mut *mut curandDirectionVectors64_t,
        set: curandDirectionVectorSet_t,
    ) -> curandStatus_t {
        (culib().curandGetDirectionVectors64)(vectors, set)
    }
    pub unsafe fn curandGetProperty(
        type_: libraryPropertyType,
        value: *mut ::core::ffi::c_int,
    ) -> curandStatus_t {
        (culib().curandGetProperty)(type_, value)
    }
    pub unsafe fn curandGetScrambleConstants32(
        constants: *mut *mut ::core::ffi::c_uint,
    ) -> curandStatus_t {
        (culib().curandGetScrambleConstants32)(constants)
    }
    pub unsafe fn curandGetScrambleConstants64(
        constants: *mut *mut ::core::ffi::c_ulonglong,
    ) -> curandStatus_t {
        (culib().curandGetScrambleConstants64)(constants)
    }
    pub unsafe fn curandGetVersion(version: *mut ::core::ffi::c_int) -> curandStatus_t {
        (culib().curandGetVersion)(version)
    }
    pub unsafe fn curandSetGeneratorOffset(
        generator: curandGenerator_t,
        offset: ::core::ffi::c_ulonglong,
    ) -> curandStatus_t {
        (culib().curandSetGeneratorOffset)(generator, offset)
    }
    pub unsafe fn curandSetGeneratorOrdering(
        generator: curandGenerator_t,
        order: curandOrdering_t,
    ) -> curandStatus_t {
        (culib().curandSetGeneratorOrdering)(generator, order)
    }
    pub unsafe fn curandSetPseudoRandomGeneratorSeed(
        generator: curandGenerator_t,
        seed: ::core::ffi::c_ulonglong,
    ) -> curandStatus_t {
        (culib().curandSetPseudoRandomGeneratorSeed)(generator, seed)
    }
    pub unsafe fn curandSetQuasiRandomGeneratorDimensions(
        generator: curandGenerator_t,
        num_dimensions: ::core::ffi::c_uint,
    ) -> curandStatus_t {
        (culib().curandSetQuasiRandomGeneratorDimensions)(generator, num_dimensions)
    }
    pub unsafe fn curandSetStream(
        generator: curandGenerator_t,
        stream: cudaStream_t,
    ) -> curandStatus_t {
        (culib().curandSetStream)(generator, stream)
    }
    pub struct Lib {
        __library: ::libloading::Library,
        pub curandCreateGenerator: unsafe extern "C" fn(
            generator: *mut curandGenerator_t,
            rng_type: curandRngType_t,
        ) -> curandStatus_t,
        pub curandCreateGeneratorHost: unsafe extern "C" fn(
            generator: *mut curandGenerator_t,
            rng_type: curandRngType_t,
        ) -> curandStatus_t,
        pub curandCreatePoissonDistribution: unsafe extern "C" fn(
            lambda: f64,
            discrete_distribution: *mut curandDiscreteDistribution_t,
        ) -> curandStatus_t,
        pub curandDestroyDistribution: unsafe extern "C" fn(
            discrete_distribution: curandDiscreteDistribution_t,
        ) -> curandStatus_t,
        pub curandDestroyGenerator:
            unsafe extern "C" fn(generator: curandGenerator_t) -> curandStatus_t,
        pub curandGenerate: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut ::core::ffi::c_uint,
            num: usize,
        ) -> curandStatus_t,
        pub curandGenerateLogNormal: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut f32,
            n: usize,
            mean: f32,
            stddev: f32,
        ) -> curandStatus_t,
        pub curandGenerateLogNormalDouble: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut f64,
            n: usize,
            mean: f64,
            stddev: f64,
        ) -> curandStatus_t,
        pub curandGenerateLongLong: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut ::core::ffi::c_ulonglong,
            num: usize,
        ) -> curandStatus_t,
        pub curandGenerateNormal: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut f32,
            n: usize,
            mean: f32,
            stddev: f32,
        ) -> curandStatus_t,
        pub curandGenerateNormalDouble: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut f64,
            n: usize,
            mean: f64,
            stddev: f64,
        ) -> curandStatus_t,
        pub curandGeneratePoisson: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut ::core::ffi::c_uint,
            n: usize,
            lambda: f64,
        ) -> curandStatus_t,
        pub curandGeneratePoissonMethod: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut ::core::ffi::c_uint,
            n: usize,
            lambda: f64,
            method: curandMethod_t,
        ) -> curandStatus_t,
        pub curandGenerateSeeds:
            unsafe extern "C" fn(generator: curandGenerator_t) -> curandStatus_t,
        pub curandGenerateUniform: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut f32,
            num: usize,
        ) -> curandStatus_t,
        pub curandGenerateUniformDouble: unsafe extern "C" fn(
            generator: curandGenerator_t,
            outputPtr: *mut f64,
            num: usize,
        ) -> curandStatus_t,
        pub curandGetDirectionVectors32: unsafe extern "C" fn(
            vectors: *mut *mut curandDirectionVectors32_t,
            set: curandDirectionVectorSet_t,
        ) -> curandStatus_t,
        pub curandGetDirectionVectors64: unsafe extern "C" fn(
            vectors: *mut *mut curandDirectionVectors64_t,
            set: curandDirectionVectorSet_t,
        ) -> curandStatus_t,
        pub curandGetProperty: unsafe extern "C" fn(
            type_: libraryPropertyType,
            value: *mut ::core::ffi::c_int,
        ) -> curandStatus_t,
        pub curandGetScrambleConstants32:
            unsafe extern "C" fn(constants: *mut *mut ::core::ffi::c_uint) -> curandStatus_t,
        pub curandGetScrambleConstants64:
            unsafe extern "C" fn(constants: *mut *mut ::core::ffi::c_ulonglong) -> curandStatus_t,
        pub curandGetVersion:
            unsafe extern "C" fn(version: *mut ::core::ffi::c_int) -> curandStatus_t,
        pub curandSetGeneratorOffset: unsafe extern "C" fn(
            generator: curandGenerator_t,
            offset: ::core::ffi::c_ulonglong,
        ) -> curandStatus_t,
        pub curandSetGeneratorOrdering: unsafe extern "C" fn(
            generator: curandGenerator_t,
            order: curandOrdering_t,
        ) -> curandStatus_t,
        pub curandSetPseudoRandomGeneratorSeed: unsafe extern "C" fn(
            generator: curandGenerator_t,
            seed: ::core::ffi::c_ulonglong,
        ) -> curandStatus_t,
        pub curandSetQuasiRandomGeneratorDimensions: unsafe extern "C" fn(
            generator: curandGenerator_t,
            num_dimensions: ::core::ffi::c_uint,
        )
            -> curandStatus_t,
        pub curandSetStream: unsafe extern "C" fn(
            generator: curandGenerator_t,
            stream: cudaStream_t,
        ) -> curandStatus_t,
    }
    impl Lib {
        pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
        where
            P: AsRef<::std::ffi::OsStr>,
        {
            let library = ::libloading::Library::new(path.as_ref())?;
            Self::from_library(library)
        }
        pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
        where
            L: Into<::libloading::Library>,
        {
            let __library = library.into();
            let curandCreateGenerator = __library
                .get(b"curandCreateGenerator\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandCreateGeneratorHost = __library
                .get(b"curandCreateGeneratorHost\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandCreatePoissonDistribution = __library
                .get(b"curandCreatePoissonDistribution\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandDestroyDistribution = __library
                .get(b"curandDestroyDistribution\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandDestroyGenerator = __library
                .get(b"curandDestroyGenerator\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerate = __library
                .get(b"curandGenerate\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerateLogNormal = __library
                .get(b"curandGenerateLogNormal\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerateLogNormalDouble = __library
                .get(b"curandGenerateLogNormalDouble\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerateLongLong = __library
                .get(b"curandGenerateLongLong\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerateNormal = __library
                .get(b"curandGenerateNormal\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerateNormalDouble = __library
                .get(b"curandGenerateNormalDouble\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGeneratePoisson = __library
                .get(b"curandGeneratePoisson\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGeneratePoissonMethod = __library
                .get(b"curandGeneratePoissonMethod\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerateSeeds = __library
                .get(b"curandGenerateSeeds\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerateUniform = __library
                .get(b"curandGenerateUniform\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGenerateUniformDouble = __library
                .get(b"curandGenerateUniformDouble\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGetDirectionVectors32 = __library
                .get(b"curandGetDirectionVectors32\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGetDirectionVectors64 = __library
                .get(b"curandGetDirectionVectors64\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGetProperty = __library
                .get(b"curandGetProperty\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGetScrambleConstants32 = __library
                .get(b"curandGetScrambleConstants32\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGetScrambleConstants64 = __library
                .get(b"curandGetScrambleConstants64\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandGetVersion = __library
                .get(b"curandGetVersion\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandSetGeneratorOffset = __library
                .get(b"curandSetGeneratorOffset\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandSetGeneratorOrdering = __library
                .get(b"curandSetGeneratorOrdering\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandSetPseudoRandomGeneratorSeed = __library
                .get(b"curandSetPseudoRandomGeneratorSeed\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandSetQuasiRandomGeneratorDimensions = __library
                .get(b"curandSetQuasiRandomGeneratorDimensions\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            let curandSetStream = __library
                .get(b"curandSetStream\0")
                .map(|sym| *sym)
                .expect("Expected symbol in library");
            Ok(Self {
                __library,
                curandCreateGenerator,
                curandCreateGeneratorHost,
                curandCreatePoissonDistribution,
                curandDestroyDistribution,
                curandDestroyGenerator,
                curandGenerate,
                curandGenerateLogNormal,
                curandGenerateLogNormalDouble,
                curandGenerateLongLong,
                curandGenerateNormal,
                curandGenerateNormalDouble,
                curandGeneratePoisson,
                curandGeneratePoissonMethod,
                curandGenerateSeeds,
                curandGenerateUniform,
                curandGenerateUniformDouble,
                curandGetDirectionVectors32,
                curandGetDirectionVectors64,
                curandGetProperty,
                curandGetScrambleConstants32,
                curandGetScrambleConstants64,
                curandGetVersion,
                curandSetGeneratorOffset,
                curandSetGeneratorOrdering,
                curandSetPseudoRandomGeneratorSeed,
                curandSetQuasiRandomGeneratorDimensions,
                curandSetStream,
            })
        }
    }
    pub unsafe fn is_culib_present() -> bool {
        let lib_names = ["curand"];
        let choices = lib_names
            .iter()
            .map(|l| crate::get_lib_name_candidates(l))
            .flatten();
        for choice in choices {
            if Lib::new(choice).is_ok() {
                return true;
            }
        }
        false
    }
    pub unsafe fn culib() -> &'static Lib {
        static LIB: std::sync::OnceLock<Lib> = std::sync::OnceLock::new();
        LIB.get_or_init(|| {
            let lib_names = std::vec!["curand"];
            let choices: std::vec::Vec<_> = lib_names
                .iter()
                .map(|l| crate::get_lib_name_candidates(l))
                .flatten()
                .collect();
            for choice in choices.iter() {
                if let Ok(lib) = Lib::new(choice) {
                    return lib;
                }
            }
            crate::panic_no_lib_found(lib_names[0], &choices);
        })
    }
}
#[cfg(feature = "dynamic-loading")]
pub use loaded::*;