-
-
Notifications
You must be signed in to change notification settings - Fork 93
/
VkFFT_TestSuite.cpp
1060 lines (1046 loc) · 38.9 KB
/
VkFFT_TestSuite.cpp
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
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <vector>
#include <memory>
#include <string.h>
#include <chrono>
#include <thread>
#include <iostream>
#include <algorithm>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#if(VKFFT_BACKEND==0)
#include "vulkan/vulkan.h"
#include "glslang_c_interface.h"
#elif(VKFFT_BACKEND==1)
#include <cuda.h>
#include <cuda_runtime.h>
#include <nvrtc.h>
#include <cuda_runtime_api.h>
#include <cuComplex.h>
#elif(VKFFT_BACKEND==2)
#ifndef __HIP_PLATFORM_HCC__
#define __HIP_PLATFORM_HCC__
#endif
#include <hip/hip_runtime.h>
#include <hip/hiprtc.h>
#include <hip/hip_runtime_api.h>
#include <hip/hip_complex.h>
#elif(VKFFT_BACKEND==3)
#ifndef CL_USE_DEPRECATED_OPENCL_1_2_APIS
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#endif
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
#elif(VKFFT_BACKEND==4)
#include <ze_api.h>
#elif(VKFFT_BACKEND==5)
#ifndef NS_PRIVATE_IMPLEMENTATION
#define NS_PRIVATE_IMPLEMENTATION
#endif
#ifndef CA_PRIVATE_IMPLEMENTATION
#define CA_PRIVATE_IMPLEMENTATION
#endif
#ifndef MTL_PRIVATE_IMPLEMENTATION
#define MTL_PRIVATE_IMPLEMENTATION
#endif
#include "Foundation/Foundation.hpp"
#include "QuartzCore/QuartzCore.hpp"
#include "Metal/Metal.hpp"
#endif
#include "vkFFT.h"
#include "utils_VkFFT.h"
#include "half.hpp"
#include "user_benchmark_VkFFT.h"
#include "sample_0_benchmark_VkFFT_single.h"
#include "sample_1_benchmark_VkFFT_double.h"
#include "sample_2_benchmark_VkFFT_half.h"
#include "sample_3_benchmark_VkFFT_single_3d.h"
#include "sample_4_benchmark_VkFFT_single_3d_zeropadding.h"
#include "sample_5_benchmark_VkFFT_single_disableReorderFourStep.h"
#include "sample_6_benchmark_VkFFT_single_r2c.h"
#include "sample_7_benchmark_VkFFT_single_Bluestein.h"
#include "sample_8_benchmark_VkFFT_double_Bluestein.h"
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
#include "sample_9_benchmark_VkFFT_quadDoubleDouble.h"
#endif
#include "sample_10_benchmark_VkFFT_single_multipleBuffers.h"
#ifdef USE_FFTW
#include "sample_11_precision_VkFFT_single.h"
#include "sample_12_precision_VkFFT_double.h"
#include "sample_13_precision_VkFFT_half.h"
#include "sample_14_precision_VkFFT_single_nonPow2.h"
#include "sample_15_precision_VkFFT_single_r2c.h"
#include "sample_16_precision_VkFFT_single_dct.h"
#include "sample_17_precision_VkFFT_double_dct.h"
#include "sample_18_precision_VkFFT_double_nonPow2.h"
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
#include "sample_19_precision_VkFFT_quadDoubleDouble_nonPow2.h"
#endif
#endif
#include "sample_50_convolution_VkFFT_single_1d_matrix.h"
#include "sample_51_convolution_VkFFT_single_3d_matrix_zeropadding_r2c.h"
#include "sample_52_convolution_VkFFT_single_2d_batched_r2c.h"
#include "sample_100_benchmark_VkFFT_single_nd_dct.h"
#include "sample_101_benchmark_VkFFT_double_nd_dct.h"
#include "sample_1000_benchmark_VkFFT_single_2_4096.h"
#include "sample_1001_benchmark_VkFFT_double_2_4096.h"
#include "sample_1002_benchmark_VkFFT_half_2_4096.h"
#include "sample_1003_benchmark_VkFFT_single_3d_2_512.h"
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
#include "sample_1004_benchmark_VkFFT_quadDoubleDouble_2_4096.h"
#endif
#ifdef USE_cuFFT
#include "user_benchmark_cuFFT.h"
#include "sample_0_benchmark_cuFFT_single.h"
#include "sample_1_benchmark_cuFFT_double.h"
#include "sample_2_benchmark_cuFFT_half.h"
#include "sample_3_benchmark_cuFFT_single_3d.h"
#include "sample_6_benchmark_cuFFT_single_r2c.h"
#include "sample_7_benchmark_cuFFT_single_Bluestein.h"
#include "sample_8_benchmark_cuFFT_double_Bluestein.h"
#include "sample_1000_benchmark_cuFFT_single_2_4096.h"
#include "sample_1001_benchmark_cuFFT_double_2_4096.h"
#include "sample_1003_benchmark_cuFFT_single_3d_2_512.h"
#endif
#ifdef USE_rocFFT
#include "user_benchmark_rocFFT.h"
#include "sample_0_benchmark_rocFFT_single.h"
#include "sample_1_benchmark_rocFFT_double.h"
#include "sample_3_benchmark_rocFFT_single_3d.h"
#include "sample_6_benchmark_rocFFT_single_r2c.h"
#include "sample_7_benchmark_rocFFT_single_Bluestein.h"
#include "sample_8_benchmark_rocFFT_double_Bluestein.h"
#include "sample_1000_benchmark_rocFFT_single_2_4096.h"
#include "sample_1001_benchmark_rocFFT_double_2_4096.h"
#include "sample_1003_benchmark_rocFFT_single_3d_2_512.h"
#endif
#ifdef USE_FFTW
#include "fftw3.h"
#endif
VkFFTResult launchVkFFT(VkGPU* vkGPU, uint64_t sample_id, bool file_output, FILE* output, VkFFTUserSystemParameters* userParams) {
//Sample Vulkan project GPU initialization.
VkFFTResult resFFT = VKFFT_SUCCESS;
#if(VKFFT_BACKEND==0)
VkResult res = VK_SUCCESS;
//create instance - a connection between the application and the Vulkan library
res = createInstance(vkGPU, sample_id);
if (res != 0) {
//printf("Instance creation failed, error code: %" PRIu64 "\n", res);
return VKFFT_ERROR_FAILED_TO_CREATE_INSTANCE;
}
//set up the debugging messenger
res = setupDebugMessenger(vkGPU);
if (res != 0) {
//printf("Debug messenger creation failed, error code: %" PRIu64 "\n", res);
return VKFFT_ERROR_FAILED_TO_SETUP_DEBUG_MESSENGER;
}
//check if there are GPUs that support Vulkan and select one
res = findPhysicalDevice(vkGPU);
if (res != 0) {
//printf("Physical device not found, error code: %" PRIu64 "\n", res);
return VKFFT_ERROR_FAILED_TO_FIND_PHYSICAL_DEVICE;
}
//create logical device representation
res = createDevice(vkGPU, sample_id);
if (res != 0) {
//printf("Device creation failed, error code: %" PRIu64 "\n", res);
return VKFFT_ERROR_FAILED_TO_CREATE_DEVICE;
}
//create fence for synchronization
res = createFence(vkGPU);
if (res != 0) {
//printf("Fence creation failed, error code: %" PRIu64 "\n", res);
return VKFFT_ERROR_FAILED_TO_CREATE_FENCE;
}
//create a place, command buffer memory is allocated from
res = createCommandPool(vkGPU);
if (res != 0) {
//printf("Fence creation failed, error code: %" PRIu64 "\n", res);
return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_POOL;
}
vkGetPhysicalDeviceProperties(vkGPU->physicalDevice, &vkGPU->physicalDeviceProperties);
vkGetPhysicalDeviceMemoryProperties(vkGPU->physicalDevice, &vkGPU->physicalDeviceMemoryProperties);
glslang_initialize_process();//compiler can be initialized before VkFFT
#elif(VKFFT_BACKEND==1)
CUresult res = CUDA_SUCCESS;
cudaError_t res2 = cudaSuccess;
res = cuInit(0);
if (res != CUDA_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
res2 = cudaSetDevice((int)vkGPU->device_id);
if (res2 != cudaSuccess) return VKFFT_ERROR_FAILED_TO_SET_DEVICE_ID;
res = cuDeviceGet(&vkGPU->device, (int)vkGPU->device_id);
if (res != CUDA_SUCCESS) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
res = cuCtxCreate(&vkGPU->context, 0, (int)vkGPU->device);
if (res != CUDA_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_CONTEXT;
#elif(VKFFT_BACKEND==2)
hipError_t res = hipSuccess;
res = hipInit(0);
if (res != hipSuccess) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
res = hipSetDevice((int)vkGPU->device_id);
if (res != hipSuccess) return VKFFT_ERROR_FAILED_TO_SET_DEVICE_ID;
res = hipDeviceGet(&vkGPU->device, (int)vkGPU->device_id);
if (res != hipSuccess) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
res = hipCtxCreate(&vkGPU->context, 0, (int)vkGPU->device);
if (res != hipSuccess) return VKFFT_ERROR_FAILED_TO_CREATE_CONTEXT;
#elif(VKFFT_BACKEND==3)
cl_int res = CL_SUCCESS;
cl_uint numPlatforms;
res = clGetPlatformIDs(0, 0, &numPlatforms);
if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
cl_platform_id* platforms = (cl_platform_id*)malloc(sizeof(cl_platform_id) * numPlatforms);
if (!platforms) return VKFFT_ERROR_MALLOC_FAILED;
res = clGetPlatformIDs(numPlatforms, platforms, 0);
if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
uint64_t k = 0;
for (uint64_t j = 0; j < numPlatforms; j++) {
cl_uint numDevices;
res = clGetDeviceIDs(platforms[j], CL_DEVICE_TYPE_ALL, 0, 0, &numDevices);
cl_device_id* deviceList = (cl_device_id*)malloc(sizeof(cl_device_id) * numDevices);
if (!deviceList) return VKFFT_ERROR_MALLOC_FAILED;
res = clGetDeviceIDs(platforms[j], CL_DEVICE_TYPE_ALL, numDevices, deviceList, 0);
if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
for (uint64_t i = 0; i < numDevices; i++) {
if (k == vkGPU->device_id) {
vkGPU->platform = platforms[j];
vkGPU->device = deviceList[i];
vkGPU->context = clCreateContext(NULL, 1, &vkGPU->device, NULL, NULL, &res);
if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_CONTEXT;
cl_command_queue commandQueue = clCreateCommandQueue(vkGPU->context, vkGPU->device, 0, &res);
if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
vkGPU->commandQueue = commandQueue;
i=numDevices;
j=numPlatforms;
}
else {
k++;
}
}
free(deviceList);
}
free(platforms);
#elif(VKFFT_BACKEND==4)
ze_result_t res = ZE_RESULT_SUCCESS;
res = zeInit(0);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
uint32_t numDrivers = 0;
res = zeDriverGet(&numDrivers, 0);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
ze_driver_handle_t* drivers = (ze_driver_handle_t*)malloc(numDrivers * sizeof(ze_driver_handle_t));
if (!drivers) return VKFFT_ERROR_MALLOC_FAILED;
res = zeDriverGet(&numDrivers, drivers);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
uint64_t k = 0;
for (uint64_t j = 0; j < numDrivers; j++) {
uint32_t numDevices = 0;
res = zeDeviceGet(drivers[j], &numDevices, nullptr);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
ze_device_handle_t* deviceList = (ze_device_handle_t*)malloc(numDevices * sizeof(ze_device_handle_t));
if (!deviceList) return VKFFT_ERROR_MALLOC_FAILED;
res = zeDeviceGet(drivers[j], &numDevices, deviceList);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
for (uint64_t i = 0; i < numDevices; i++) {
if (k == vkGPU->device_id) {
vkGPU->driver = drivers[j];
vkGPU->device = deviceList[i];
ze_context_desc_t contextDescription = {};
contextDescription.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC;
res = zeContextCreate(vkGPU->driver, &contextDescription, &vkGPU->context);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_CONTEXT;
uint32_t queueGroupCount = 0;
res = zeDeviceGetCommandQueueGroupProperties(vkGPU->device, &queueGroupCount, 0);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
ze_command_queue_group_properties_t* cmdqueueGroupProperties = (ze_command_queue_group_properties_t*)malloc(queueGroupCount * sizeof(ze_command_queue_group_properties_t));
if (!cmdqueueGroupProperties) return VKFFT_ERROR_MALLOC_FAILED;
res = zeDeviceGetCommandQueueGroupProperties(vkGPU->device, &queueGroupCount, cmdqueueGroupProperties);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
uint32_t commandQueueID = -1;
for (uint32_t i = 0; i < queueGroupCount; ++i) {
if ((cmdqueueGroupProperties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE) && (cmdqueueGroupProperties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY)) {
commandQueueID = i;
break;
}
}
if (commandQueueID == -1) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
vkGPU->commandQueueID = commandQueueID;
ze_command_queue_desc_t commandQueueDescription = {};
commandQueueDescription.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC;
commandQueueDescription.ordinal = commandQueueID;
commandQueueDescription.priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
commandQueueDescription.mode = ZE_COMMAND_QUEUE_MODE_DEFAULT;
res = zeCommandQueueCreate(vkGPU->context, vkGPU->device, &commandQueueDescription, &vkGPU->commandQueue);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
free(cmdqueueGroupProperties);
i=numDevices;
j=numDrivers;
}
else {
k++;
}
}
free(deviceList);
}
free(drivers);
#elif(VKFFT_BACKEND==5)
NS::Array* devices = MTL::CopyAllDevices();
MTL::Device* device = (MTL::Device*)devices->object(vkGPU->device_id);
vkGPU->device = device;
MTL::CommandQueue* queue = device->newCommandQueue();
vkGPU->queue = queue;
#endif
uint64_t isCompilerInitialized = 1;
switch (sample_id) {
case 0:
{
resFFT = sample_0_benchmark_VkFFT_single(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 1:
{
resFFT = sample_1_benchmark_VkFFT_double(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 2:
{
resFFT = sample_2_benchmark_VkFFT_half(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 3:
{
resFFT = sample_3_benchmark_VkFFT_single_3d(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 4:
{
resFFT = sample_4_benchmark_VkFFT_single_3d_zeropadding(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 5:
{
resFFT = sample_5_benchmark_VkFFT_single_disableReorderFourStep(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 6:
{
resFFT = sample_6_benchmark_VkFFT_single_r2c(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 7:
{
resFFT = sample_7_benchmark_VkFFT_single_Bluestein(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 8:
{
resFFT = sample_8_benchmark_VkFFT_double_Bluestein(vkGPU, file_output, output, isCompilerInitialized);
break;
}
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
case 9:
{
resFFT = sample_9_benchmark_VkFFT_quadDoubleDouble(vkGPU, file_output, output, isCompilerInitialized);
break;
}
#endif
#if(VKFFT_BACKEND==0)
case 10:
{
resFFT = sample_10_benchmark_VkFFT_single_multipleBuffers(vkGPU, file_output, output, isCompilerInitialized);
break;
}
#endif
#ifdef USE_FFTW
case 11:
{
resFFT = sample_11_precision_VkFFT_single(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 12:
{
resFFT = sample_12_precision_VkFFT_double(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 13:
{
resFFT = sample_13_precision_VkFFT_half(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 14:
{
resFFT = sample_14_precision_VkFFT_single_nonPow2(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 15:
{
resFFT = sample_15_precision_VkFFT_single_r2c(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 16:
{
resFFT = sample_16_precision_VkFFT_single_dct(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 17:
{
resFFT = sample_17_precision_VkFFT_double_dct(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 18:
{
resFFT = sample_18_precision_VkFFT_double_nonPow2(vkGPU, file_output, output, isCompilerInitialized);
break;
}
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
case 19:
{
resFFT = sample_19_precision_VkFFT_quadDoubleDouble_nonPow2(vkGPU, file_output, output, isCompilerInitialized);
break;
}
#endif
#endif
case 50:
{
resFFT = sample_50_convolution_VkFFT_single_1d_matrix(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 51:
{
resFFT = sample_51_convolution_VkFFT_single_3d_matrix_zeropadding_r2c(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 52:
{
resFFT = sample_52_convolution_VkFFT_single_2d_batched_r2c(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 110:
{
resFFT = sample_100_benchmark_VkFFT_single_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 1);
break;
}
case 120:
{
resFFT = sample_100_benchmark_VkFFT_single_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 2);
break;
}
case 130:
{
resFFT = sample_100_benchmark_VkFFT_single_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 3);
break;
}
case 140:
{
resFFT = sample_100_benchmark_VkFFT_single_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 4);
break;
}
case 111:
{
resFFT = sample_101_benchmark_VkFFT_double_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 1);
break;
}
case 121:
{
resFFT = sample_101_benchmark_VkFFT_double_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 2);
break;
}
case 131:
{
resFFT = sample_101_benchmark_VkFFT_double_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 3);
break;
}
case 141:
{
resFFT = sample_101_benchmark_VkFFT_double_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 4);
break;
}
case 200: case 201: case 202:
{
resFFT = user_benchmark_VkFFT(vkGPU, file_output, output, isCompilerInitialized, userParams);
break;
}
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
case 203:
{
resFFT = user_benchmark_VkFFT(vkGPU, file_output, output, isCompilerInitialized, userParams);
break;
}
#endif
case 1000:
{
resFFT = sample_1000_benchmark_VkFFT_single_2_4096(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 1001:
{
resFFT = sample_1001_benchmark_VkFFT_double_2_4096(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 1002:
{
resFFT = sample_1002_benchmark_VkFFT_half_2_4096(vkGPU, file_output, output, isCompilerInitialized);
break;
}
case 1003:
{
resFFT = sample_1003_benchmark_VkFFT_single_3d_2_512(vkGPU, file_output, output, isCompilerInitialized);
break;
}
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
case 1004:
{
resFFT = sample_1004_benchmark_VkFFT_quadDoubleDouble_2_4096(vkGPU, file_output, output, isCompilerInitialized);
break;
}
#endif
}
#if(VKFFT_BACKEND==0)
vkDestroyFence(vkGPU->device, vkGPU->fence, NULL);
vkDestroyCommandPool(vkGPU->device, vkGPU->commandPool, NULL);
vkDestroyDevice(vkGPU->device, NULL);
DestroyDebugUtilsMessengerEXT(vkGPU, NULL);
vkDestroyInstance(vkGPU->instance, NULL);
glslang_finalize_process();//destroy compiler after use
#elif(VKFFT_BACKEND==1)
res = cuCtxDestroy(vkGPU->context);
#elif(VKFFT_BACKEND==2)
res = hipCtxDestroy(vkGPU->context);
#elif(VKFFT_BACKEND==3)
res = clReleaseCommandQueue(vkGPU->commandQueue);
if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_RELEASE_COMMAND_QUEUE;
clReleaseContext(vkGPU->context);
#elif(VKFFT_BACKEND==4)
res = zeCommandQueueDestroy(vkGPU->commandQueue);
if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_RELEASE_COMMAND_QUEUE;
res = zeContextDestroy(vkGPU->context);
#elif(VKFFT_BACKEND==5)
vkGPU->queue->release();
vkGPU->device->release();
devices->release();
#endif
return resFFT;
}
bool findFlag(char** start, char** end, const std::string& flag) {
return (std::find(start, end, flag) != end);
}
char* getFlagValue(char** start, char** end, const std::string& flag)
{
char** value = std::find(start, end, flag);
value++;
if (value != end)
{
return *value;
}
return 0;
}
int main(int argc, char* argv[])
{
VkGPU vkGPU = {};
#if(VKFFT_BACKEND==0)
vkGPU.enableValidationLayers = 0;
#endif
bool file_output = false;
FILE* output = NULL;
int sscanf_res = 0;
if (findFlag(argv, argv + argc, "-h"))
{
//print help
int version = VkFFTGetVersion();
int version_decomposed[3];
version_decomposed[0] = version / 10000;
version_decomposed[1] = (version - version_decomposed[0] * 10000) / 100;
version_decomposed[2] = (version - version_decomposed[0] * 10000 - version_decomposed[1] * 100);
printf("VkFFT v%d.%d.%d (05-02-2024). Author: Tolmachev Dmitrii\n", version_decomposed[0], version_decomposed[1], version_decomposed[2]);
#if (VKFFT_BACKEND==0)
printf("Vulkan backend\n");
#elif (VKFFT_BACKEND==1)
printf("CUDA backend\n");
#elif (VKFFT_BACKEND==2)
printf("HIP backend\n");
#elif (VKFFT_BACKEND==3)
printf("OpenCL backend\n");
#elif (VKFFT_BACKEND==4)
printf("Level Zero backend\n");
#elif (VKFFT_BACKEND==5)
printf("Metal backend\n");
#endif
printf(" -h: print help\n");
printf(" -devices: print the list of available device ids, used as -d argument\n");
printf(" -d X: select device (default 0)\n");
printf(" -o NAME: specify output file path\n");
printf(" -vkfft X: launch VkFFT sample X:\n");
printf(" 0 - FFT + iFFT C2C benchmark 1D batched in single precision\n");
printf(" 1 - FFT + iFFT C2C benchmark 1D batched in double precision LUT\n");
printf(" 2 - FFT + iFFT C2C benchmark 1D batched in half precision\n");
printf(" 3 - FFT + iFFT C2C multidimensional benchmark in single precision\n");
printf(" 4 - FFT + iFFT C2C multidimensional benchmark in single precision, native zeropadding\n");
printf(" 5 - FFT + iFFT C2C benchmark 1D batched in single precision, no reshuffling\n");
printf(" 6 - FFT + iFFT R2C / C2R benchmark\n");
printf(" 7 - FFT + iFFT C2C Bluestein benchmark in single precision\n");
printf(" 8 - FFT + iFFT C2C Bluestein benchmark in double precision\n");
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
printf(" 9 - FFT + iFFT C2C benchmark 1D batched in double-double emulation of quad precision LUT\n");
#endif
#if (VKFFT_BACKEND==0)
printf(" 10 - multiple buffer(4 by default) split version of benchmark 0\n");
#endif
#ifdef USE_FFTW
#ifdef USE_cuFFT
printf(" 11 - VkFFT / cuFFT / FFTW C2C precision test in single precision\n");
printf(" 12 - VkFFT / cuFFT / FFTW C2C precision test in double precision\n");
printf(" 13 - VkFFT / cuFFT / FFTW C2C precision test in half precision\n");
printf(" 14 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in single precision\n");
printf(" 15 - VkFFT / cuFFT / FFTW R2C+C2R precision test in single precision\n");
printf(" 16 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in single precision\n");
printf(" 17 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in double precision\n");
printf(" 18 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in double precision\n");
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
printf(" 19 - VkFFT / FFTW C2C precision test in double-double emulation of quad precision\n");
#endif
#elif USE_rocFFT
printf(" 11 - VkFFT / rocFFT / FFTW C2C precision test in single precision\n");
printf(" 12 - VkFFT / rocFFT / FFTW C2C precision test in double precision\n");
printf(" 13 - VkFFT / FFTW C2C precision test in half precision\n");
printf(" 14 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in single precision\n");
printf(" 15 - VkFFT / rocFFT / FFTW R2C+C2R precision test in single precision\n");
printf(" 16 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in single precision\n");
printf(" 17 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in double precision\n");
printf(" 18 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in double precision\n");
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
printf(" 19 - VkFFT / FFTW C2C precision test in double-double emulation of quad precision\n");
#endif
#else
printf(" 11 - VkFFT / FFTW C2C precision test in single precision\n");
printf(" 12 - VkFFT / FFTW C2C precision test in double precision\n");
printf(" 13 - VkFFT / FFTW C2C precision test in half precision\n");
printf(" 14 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in single precision\n");
printf(" 15 - VkFFT / FFTW R2C+C2R precision test in single precision\n");
printf(" 16 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in single precision\n");
printf(" 17 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in double precision\n");
printf(" 18 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in double precision\n");
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
printf(" 19 - VkFFT / FFTW C2C precision test in double-double emulation of quad precision\n");
#endif
#endif
#endif
printf(" 50 - convolution example with identity kernel\n");
printf(" 51 - zeropadding convolution example with identity kernel\n");
printf(" 52 - batched convolution example with identity kernel\n");
printf(" 110 - VkFFT FFT + iFFT R2R DCT-1 multidimensional benchmark in single precision\n");
printf(" 111 - VkFFT FFT + iFFT R2R DCT-1 multidimensional benchmark in double precision\n");
printf(" 120 - VkFFT FFT + iFFT R2R DCT-2 multidimensional benchmark in single precision\n");
printf(" 121 - VkFFT FFT + iFFT R2R DCT-2 multidimensional benchmark in double precision\n");
printf(" 130 - VkFFT FFT + iFFT R2R DCT-3 multidimensional benchmark in single precision\n");
printf(" 131 - VkFFT FFT + iFFT R2R DCT-3 multidimensional benchmark in double precision\n");
printf(" 140 - VkFFT FFT + iFFT R2R DCT-4 multidimensional benchmark in single precision\n");
printf(" 141 - VkFFT FFT + iFFT R2R DCT-4 multidimensional benchmark in double precision\n");
printf(" 1000 - FFT + iFFT C2C benchmark 1D batched in single precision: all supported systems from 2 to 4096\n");
printf(" 1001 - FFT + iFFT C2C benchmark 1D batched in double precision: all supported systems from 2 to 4096\n");
printf(" 1002 - FFT + iFFT C2C benchmark 1D batched in half precision: all supported systems from 2 to 4096\n");
printf(" 1003 - FFT + iFFT C2C multidimensional benchmark in single precision: all supported cubes from 2 to 512\n");
#ifdef VKFFT_USE_DOUBLEDOUBLE_FP128
printf(" 1004 - FFT + iFFT C2C benchmark 1D batched in double-double emulation of quad precision: all supported systems from 2 to 4096\n");
#endif
printf(" -benchmark_vkfft: run VkFFT benchmark on a user-defined system:\n\
-X uint, -Y uint, -Z uint - FFT dimensions (default Y and Z are 1)\n");
printf("\
-P uint - precision (0 - single, 1 - double, 2 - half, 3 - double-double) (default 0)\n");
printf("\
-B uint - number of batched systems (default 1)\n\
-N uint - number of consecutive FFT+iFFT iterations (default 1)\n\
-R2C uint - use R2C (0 - off, 1 - on) (default 0)\n\
-DCT uint - perform DCT (0 - off, else type: 1, 2, 3 or 4) (default 0)\n\
-save - save generated binaries\n\
-load - load previously generated binaries\n");
#ifdef USE_cuFFT
printf(" -cufft X: launch cuFFT sample X:\n");
printf(" 0 - FFT + iFFT C2C benchmark 1D batched in single precision\n");
printf(" 1 - FFT + iFFT C2C benchmark 1D batched in double precision LUT\n");
printf(" 2 - FFT + iFFT C2C benchmark 1D batched in half precision\n");
printf(" 3 - FFT + iFFT C2C multidimensional benchmark in single precision\n");
printf(" 6 - FFT + iFFT R2C / C2R benchmark\n");
printf(" 7 - FFT + iFFT C2C big prime benchmark in single precision (similar to VkFFT Bluestein)\n");
printf(" 8 - FFT + iFFT C2C big prime benchmark in double precision (similar to VkFFT Bluestein)\n");
printf(" 1000 - FFT + iFFT C2C benchmark 1D batched in single precision: all supported systems from 2 to 4096\n");
printf(" 1001 - FFT + iFFT C2C benchmark 1D batched in double precision: all supported systems from 2 to 4096\n");
printf(" 1003 - FFT + iFFT C2C multidimensional benchmark in single precision: all supported cubes from 2 to 512\n");
printf(" -test: (or no -vkfft and -cufft keys) run vkfft benchmarks 0-6 and cufft benchmarks 0-6\n");
printf(" -benchmark_cufft: run cuFFT benchmark on a user-defined system:\n\
-X uint, -Y uint, -Z uint - FFT dimensions (default Y and Z are 1)\n\
-P uint - precision (0 - single, 1 - double) (default 0)\n\
-B uint - number of batched systems (default 1)\n\
-N uint - number of consecutive FFT+iFFT iterations (default 1)\n\
-R2C uint - use R2C (0 - off, 1 - on) (default 0)\n");
#elif USE_rocFFT
printf(" -rocfft X: launch rocFFT sample X:\n");
printf(" 0 - FFT + iFFT C2C benchmark 1D batched in single precision\n");
printf(" 1 - FFT + iFFT C2C benchmark 1D batched in double precision LUT\n");
printf(" 3 - FFT + iFFT C2C multidimensional benchmark in single precision\n");
printf(" 6 - FFT + iFFT R2C / C2R benchmark\n");
printf(" 7 - FFT + iFFT C2C big prime benchmark in single precision (similar to VkFFT Bluestein)\n");
printf(" 8 - FFT + iFFT C2C big prime benchmark in double precision (similar to VkFFT Bluestein)\n");
printf(" 1000 - FFT + iFFT C2C benchmark 1D batched in single precision: all supported systems from 2 to 4096\n");
printf(" 1001 - FFT + iFFT C2C benchmark 1D batched in double precision: all supported systems from 2 to 4096\n");
printf(" 1003 - FFT + iFFT C2C multidimensional benchmark in single precision: all supported cubes from 2 to 512\n");
printf(" -test: (or no -vkfft and -rocfft keys) run vkfft benchmarks 0-6 and rocfft benchmarks 0-6\n");
printf(" -benchmark_rocfft: run rocFFT benchmark on a user-defined system:\n\
-X uint, -Y uint, -Z uint - FFT dimensions (default Y and Z are 1)\n\
-P uint - precision (0 - single, 1 - double) (default 0)\n\
-B uint - number of batched systems (default 1)\n\
-N uint - number of consecutive FFT+iFFT iterations (default 1)\n\
-R2C uint - use R2C (0 - off, 1 - on) (default 0)\n");
#else
printf(" -test: run vkfft benchmarks 0-6\n");
printf(" -cufft command is disabled\n");
printf(" -rocfft command is disabled\n");
#endif
return 0;
}
if (findFlag(argv, argv + argc, "-devices"))
{
//print device list
VkFFTResult resFFT = devices_list();
return resFFT;
}
if (findFlag(argv, argv + argc, "-d"))
{
//select device_id
char* value = getFlagValue(argv, argv + argc, "-d");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &vkGPU.device_id);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No device is selected with -d flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-o"))
{
//specify output file
char* value = getFlagValue(argv, argv + argc, "-o");
if (value != 0) {
file_output = true;
output = fopen(value, "a");
}
else {
printf("No output file is selected with -o flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-benchmark_vkfft") || findFlag(argv, argv + argc, "-benchmark_cufft") || findFlag(argv, argv + argc, "-benchmark_rocfft"))
{
//select sample_id
VkFFTUserSystemParameters userParams = {};
userParams.X = 1;
userParams.Y = 1;
userParams.Z = 1;
userParams.P = 0;
userParams.B = 1;
userParams.N = 1;
userParams.R2C = 0;
userParams.DCT = 0;
if (findFlag(argv, argv + argc, "-X"))
{
char* value = getFlagValue(argv, argv + argc, "-X");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.X);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No dimension is selected with -X flag\n");
return 1;
}
}
else {
printf("No -X flag is selected\n");
return 1;
}
if (findFlag(argv, argv + argc, "-Y"))
{
char* value = getFlagValue(argv, argv + argc, "-Y");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.Y);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No dimension is selected with -Y flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-Z"))
{
char* value = getFlagValue(argv, argv + argc, "-Z");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.Z);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No dimension is selected with -Z flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-P"))
{
char* value = getFlagValue(argv, argv + argc, "-P");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.P);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No precision is selected with -P flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-B"))
{
char* value = getFlagValue(argv, argv + argc, "-B");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.B);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No batch is selected with -B flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-N"))
{
char* value = getFlagValue(argv, argv + argc, "-N");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.N);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No number of iterations is selected with -N flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-R2C"))
{
char* value = getFlagValue(argv, argv + argc, "-R2C");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.R2C);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No R2C parameter is selected with -R2C flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-DCT"))
{
char* value = getFlagValue(argv, argv + argc, "-DCT");
if (value != 0) {
sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.DCT);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
}
else {
printf("No DCT parameter is selected with -DCT flag\n");
return 1;
}
}
if (findFlag(argv, argv + argc, "-save"))
{
userParams.saveApplicationToString = 1;
}
if (findFlag(argv, argv + argc, "-load"))
{
userParams.loadApplicationFromString = 1;
}
if (findFlag(argv, argv + argc, "-benchmark_vkfft")) {
VkFFTResult resFFT = launchVkFFT(&vkGPU, 200 + userParams.P, file_output, output, &userParams);
if (resFFT != VKFFT_SUCCESS) return resFFT;
}
else {
#ifdef USE_cuFFT
if (findFlag(argv, argv + argc, "-benchmark_cufft")) {
user_benchmark_cuFFT(file_output, output, (cuFFTUserSystemParameters*)(&userParams), (int)vkGPU.device_id);
}
return 0;
#elif USE_rocFFT
if (findFlag(argv, argv + argc, "-benchmark_rocfft")) {
user_benchmark_rocFFT(file_output, output, (rocFFTUserSystemParameters*)(&userParams), (int)vkGPU.device_id);
}
return 0;
#endif
return 1;
}
return 0;
}
if (findFlag(argv, argv + argc, "-vkfft"))
{
//select sample_id
char* value = getFlagValue(argv, argv + argc, "-vkfft");
if (value != 0) {
uint64_t sample_id = 0;
sscanf_res = sscanf(value, "%" PRIu64 "", &sample_id);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
VkFFTResult resFFT = launchVkFFT(&vkGPU, sample_id, file_output, output, 0);
if (resFFT != VKFFT_SUCCESS) return resFFT;
}
else {
printf("No sample is selected with -vkfft flag\n");
return 1;
}
}
#ifdef USE_cuFFT
if (findFlag(argv, argv + argc, "-cufft"))
{
//select sample_id
char* value = getFlagValue(argv, argv + argc, "-cufft");
if (value != 0) {
uint64_t sample_id = 0;
sscanf_res = sscanf(value, "%" PRIu64 "", &sample_id);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
switch (sample_id) {
case 0:
sample_0_benchmark_cuFFT_single(file_output, output, (int)vkGPU.device_id);
break;
case 1:
sample_1_benchmark_cuFFT_double(file_output, output, (int)vkGPU.device_id);
break;
case 2:
sample_2_benchmark_cuFFT_half(file_output, output, (int)vkGPU.device_id);
break;
case 3:
sample_3_benchmark_cuFFT_single_3d(file_output, output, (int)vkGPU.device_id);
break;
case 6:
sample_6_benchmark_cuFFT_single_r2c(file_output, output, (int)vkGPU.device_id);
break;
case 7:
sample_7_benchmark_cuFFT_single_Bluestein(file_output, output, (int)vkGPU.device_id);
break;
case 8:
sample_8_benchmark_cuFFT_double_Bluestein(file_output, output, (int)vkGPU.device_id);
break;
case 1000:
sample_1000_benchmark_cuFFT_single_2_4096(file_output, output, (int)vkGPU.device_id);
break;
case 1001:
sample_1001_benchmark_cuFFT_double_2_4096(file_output, output, (int)vkGPU.device_id);
break;
case 1003:
sample_1003_benchmark_cuFFT_single_3d_2_512(file_output, output, (int)vkGPU.device_id);
break;
}
}
else {
printf("No cuFFT script is selected with -cufft flag\n");
return 1;
}
}
#elif USE_rocFFT
if (findFlag(argv, argv + argc, "-rocfft"))
{
//select sample_id
char* value = getFlagValue(argv, argv + argc, "-rocfft");
if (value != 0) {
uint64_t sample_id = 0;
sscanf_res = sscanf(value, "%" PRIu64 "", &sample_id);
if (sscanf_res <= 0) {
printf("sscanf failed\n");
return 1;
}
switch (sample_id) {
case 0:
sample_0_benchmark_rocFFT_single(file_output, output, (int)vkGPU.device_id);
break;
case 1:
sample_1_benchmark_rocFFT_double(file_output, output, (int)vkGPU.device_id);
break;
case 3: