yum-mirror/VkFFT

git clone https://git.yummers.dev/yum-mirror/VkFFT

Tolmachev DmitriiRadix 6, 8, 9, 10, 12, 14, 15, 16, 32 support + Bluestein tuning -Added support for more composite radix kenrels. Improves performance by reducing shared memory communications -Added Bluestein sequence advanced tuning: can now specify the sequence to pad to. Added default tuned values for FP32 and FP64 for Nvidia A100 and AMD MI250 for sequences up to 4096 -Improved LUT usage: do not upload the first radix, coalesced upload to shared memory for small stage requests. -Bugfixes: C2R check for big radix, matrix convolution coordinate assignment, specification of device_id in cuFFT/rocFFT scripts9640836

v1.2.26
36.0 KiB1003 linesraw
1#include <vector>
2#include <memory>
3#include <string.h>
4#include <chrono>
5#include <thread>
6#include <iostream>
7#include <algorithm>
8#define __STDC_FORMAT_MACROS
9#include <inttypes.h>
10#if(VKFFT_BACKEND==0)
11#include "vulkan/vulkan.h"
12#include "glslang_c_interface.h"
13#elif(VKFFT_BACKEND==1)
14#include <cuda.h>
15#include <cuda_runtime.h>
16#include <nvrtc.h>
17#include <cuda_runtime_api.h>
18#include <cuComplex.h>
19#elif(VKFFT_BACKEND==2)
20#ifndef __HIP_PLATFORM_HCC__
21#define __HIP_PLATFORM_HCC__
22#endif
23#include <hip/hip_runtime.h>
24#include <hip/hiprtc.h>
25#include <hip/hip_runtime_api.h>
26#include <hip/hip_complex.h>
27#elif(VKFFT_BACKEND==3)
28#ifndef CL_USE_DEPRECATED_OPENCL_1_2_APIS
29#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
30#endif
31#ifdef __APPLE__
32#include <OpenCL/opencl.h>
33#else
34#include <CL/cl.h>
35#endif 
36#elif(VKFFT_BACKEND==4)
37#include <ze_api.h>
38#endif
39#include "vkFFT.h"
40#include "utils_VkFFT.h"
41#include "half.hpp"
42#include "user_benchmark_VkFFT.h"
43#include "sample_0_benchmark_VkFFT_single.h"
44#include "sample_1_benchmark_VkFFT_double.h"
45#if(VKFFT_BACKEND==0)
46#include "sample_2_benchmark_VkFFT_half.h"
47#endif
48#include "sample_3_benchmark_VkFFT_single_3d.h"
49#include "sample_4_benchmark_VkFFT_single_3d_zeropadding.h"
50#include "sample_5_benchmark_VkFFT_single_disableReorderFourStep.h"
51#include "sample_6_benchmark_VkFFT_single_r2c.h"
52#include "sample_7_benchmark_VkFFT_single_Bluestein.h"
53#include "sample_8_benchmark_VkFFT_double_Bluestein.h"
54#include "sample_10_benchmark_VkFFT_single_multipleBuffers.h"
55#ifdef USE_FFTW
56#include "sample_11_precision_VkFFT_single.h"
57#include "sample_12_precision_VkFFT_double.h"
58#if(VKFFT_BACKEND==0)
59#include "sample_13_precision_VkFFT_half.h"
60#endif
61#include "sample_14_precision_VkFFT_single_nonPow2.h"
62#include "sample_15_precision_VkFFT_single_r2c.h"
63#include "sample_16_precision_VkFFT_single_dct.h"
64#include "sample_17_precision_VkFFT_double_dct.h"
65#include "sample_18_precision_VkFFT_double_nonPow2.h"
66#endif
67#include "sample_50_convolution_VkFFT_single_1d_matrix.h"
68#include "sample_51_convolution_VkFFT_single_3d_matrix_zeropadding_r2c.h"
69#include "sample_52_convolution_VkFFT_single_2d_batched_r2c.h"
70
71#include "sample_100_benchmark_VkFFT_single_nd_dct.h"
72#include "sample_101_benchmark_VkFFT_double_nd_dct.h"
73#include "sample_1000_VkFFT_single_2_4096.h"
74#include "sample_1001_benchmark_VkFFT_double_2_4096.h"
75#include "sample_1003_benchmark_VkFFT_single_3d_2_512.h"
76
77#ifdef USE_cuFFT
78#include "user_benchmark_cuFFT.h"
79#include "sample_0_benchmark_cuFFT_single.h"
80#include "sample_1_benchmark_cuFFT_double.h"
81#include "sample_2_benchmark_cuFFT_half.h"
82#include "sample_3_benchmark_cuFFT_single_3d.h"
83#include "sample_6_benchmark_cuFFT_single_r2c.h"
84#include "sample_7_benchmark_cuFFT_single_Bluestein.h"
85#include "sample_8_benchmark_cuFFT_double_Bluestein.h"
86#include "sample_1000_benchmark_cuFFT_single_2_4096.h"
87#include "sample_1001_benchmark_cuFFT_double_2_4096.h"
88#include "sample_1003_benchmark_cuFFT_single_3d_2_512.h"
89#endif  
90#ifdef USE_rocFFT
91#include "user_benchmark_rocFFT.h"
92#include "sample_0_benchmark_rocFFT_single.h"
93#include "sample_1_benchmark_rocFFT_double.h"
94#include "sample_3_benchmark_rocFFT_single_3d.h"
95#include "sample_6_benchmark_rocFFT_single_r2c.h"
96#include "sample_7_benchmark_rocFFT_single_Bluestein.h"
97#include "sample_8_benchmark_rocFFT_double_Bluestein.h"
98#include "sample_1000_benchmark_rocFFT_single_2_4096.h"
99#include "sample_1001_benchmark_rocFFT_double_2_4096.h"
100#include "sample_1003_benchmark_rocFFT_single_3d_2_512.h"
101#endif 
102#ifdef USE_FFTW
103#include "fftw3.h"
104#endif
105
106VkFFTResult launchVkFFT(VkGPU* vkGPU, uint64_t sample_id, bool file_output, FILE* output, VkFFTUserSystemParameters* userParams) {
107	//Sample Vulkan project GPU initialization.
108	VkFFTResult resFFT = VKFFT_SUCCESS;
109
110#if(VKFFT_BACKEND==0)
111	VkResult res = VK_SUCCESS;
112	//create instance - a connection between the application and the Vulkan library 
113	res = createInstance(vkGPU, sample_id);
114	if (res != 0) {
115		//printf("Instance creation failed, error code: %" PRIu64 "\n", res);
116		return VKFFT_ERROR_FAILED_TO_CREATE_INSTANCE;
117	}
118	//set up the debugging messenger 
119	res = setupDebugMessenger(vkGPU);
120	if (res != 0) {
121		//printf("Debug messenger creation failed, error code: %" PRIu64 "\n", res);
122		return VKFFT_ERROR_FAILED_TO_SETUP_DEBUG_MESSENGER;
123	}
124	//check if there are GPUs that support Vulkan and select one
125	res = findPhysicalDevice(vkGPU);
126	if (res != 0) {
127		//printf("Physical device not found, error code: %" PRIu64 "\n", res);
128		return VKFFT_ERROR_FAILED_TO_FIND_PHYSICAL_DEVICE;
129	}
130	//create logical device representation
131	res = createDevice(vkGPU, sample_id);
132	if (res != 0) {
133		//printf("Device creation failed, error code: %" PRIu64 "\n", res);
134		return VKFFT_ERROR_FAILED_TO_CREATE_DEVICE;
135	}
136	//create fence for synchronization 
137	res = createFence(vkGPU);
138	if (res != 0) {
139		//printf("Fence creation failed, error code: %" PRIu64 "\n", res);
140		return VKFFT_ERROR_FAILED_TO_CREATE_FENCE;
141	}
142	//create a place, command buffer memory is allocated from
143	res = createCommandPool(vkGPU);
144	if (res != 0) {
145		//printf("Fence creation failed, error code: %" PRIu64 "\n", res);
146		return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_POOL;
147	}
148	vkGetPhysicalDeviceProperties(vkGPU->physicalDevice, &vkGPU->physicalDeviceProperties);
149	vkGetPhysicalDeviceMemoryProperties(vkGPU->physicalDevice, &vkGPU->physicalDeviceMemoryProperties);
150
151	glslang_initialize_process();//compiler can be initialized before VkFFT
152#elif(VKFFT_BACKEND==1)
153	CUresult res = CUDA_SUCCESS;
154	cudaError_t res2 = cudaSuccess;
155	res = cuInit(0);
156	if (res != CUDA_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
157	res2 = cudaSetDevice((int)vkGPU->device_id);
158	if (res2 != cudaSuccess) return VKFFT_ERROR_FAILED_TO_SET_DEVICE_ID;
159	res = cuDeviceGet(&vkGPU->device, (int)vkGPU->device_id);
160	if (res != CUDA_SUCCESS) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
161	res = cuCtxCreate(&vkGPU->context, 0, (int)vkGPU->device);
162	if (res != CUDA_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_CONTEXT;
163#elif(VKFFT_BACKEND==2)
164	hipError_t res = hipSuccess;
165	res = hipInit(0);
166	if (res != hipSuccess) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
167	res = hipSetDevice((int)vkGPU->device_id);
168	if (res != hipSuccess) return VKFFT_ERROR_FAILED_TO_SET_DEVICE_ID;
169	res = hipDeviceGet(&vkGPU->device, (int)vkGPU->device_id);
170	if (res != hipSuccess) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
171	res = hipCtxCreate(&vkGPU->context, 0, (int)vkGPU->device);
172	if (res != hipSuccess) return VKFFT_ERROR_FAILED_TO_CREATE_CONTEXT;
173#elif(VKFFT_BACKEND==3)
174	cl_int res = CL_SUCCESS;
175	cl_uint numPlatforms;
176	res = clGetPlatformIDs(0, 0, &numPlatforms);
177	if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
178	cl_platform_id* platforms = (cl_platform_id*)malloc(sizeof(cl_platform_id) * numPlatforms);
179	if (!platforms) return VKFFT_ERROR_MALLOC_FAILED;
180	res = clGetPlatformIDs(numPlatforms, platforms, 0);
181	if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
182	uint64_t k = 0;
183	for (uint64_t j = 0; j < numPlatforms; j++) {
184		cl_uint numDevices;
185		res = clGetDeviceIDs(platforms[j], CL_DEVICE_TYPE_ALL, 0, 0, &numDevices);
186		cl_device_id* deviceList = (cl_device_id*)malloc(sizeof(cl_device_id) * numDevices);
187		if (!deviceList) return VKFFT_ERROR_MALLOC_FAILED;
188		res = clGetDeviceIDs(platforms[j], CL_DEVICE_TYPE_ALL, numDevices, deviceList, 0);
189		if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
190		for (uint64_t i = 0; i < numDevices; i++) {
191			if (k == vkGPU->device_id) {
192				vkGPU->platform = platforms[j];
193				vkGPU->device = deviceList[i];
194				vkGPU->context = clCreateContext(NULL, 1, &vkGPU->device, NULL, NULL, &res);
195				if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_CONTEXT;
196				cl_command_queue commandQueue = clCreateCommandQueue(vkGPU->context, vkGPU->device, 0, &res);
197				if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
198				vkGPU->commandQueue = commandQueue;
199				k++;
200			}
201			else {
202				k++;
203			}
204		}
205		free(deviceList);
206	}
207	free(platforms);
208#elif(VKFFT_BACKEND==4)
209	ze_result_t res = ZE_RESULT_SUCCESS;
210	res = zeInit(0);
211	if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
212	uint32_t numDrivers = 0;
213	res = zeDriverGet(&numDrivers, 0);
214	if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
215	ze_driver_handle_t* drivers = (ze_driver_handle_t*)malloc(numDrivers * sizeof(ze_driver_handle_t));
216	if (!drivers) return VKFFT_ERROR_MALLOC_FAILED;
217	res = zeDriverGet(&numDrivers, drivers);
218	if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_INITIALIZE;
219	uint64_t k = 0;
220	for (uint64_t j = 0; j < numDrivers; j++) {
221		uint32_t numDevices = 0;
222		res = zeDeviceGet(drivers[j], &numDevices, nullptr);
223		if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
224		ze_device_handle_t* deviceList = (ze_device_handle_t*)malloc(numDevices * sizeof(ze_device_handle_t));
225		if (!deviceList) return VKFFT_ERROR_MALLOC_FAILED;
226		res = zeDeviceGet(drivers[j], &numDevices, deviceList);
227		if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_GET_DEVICE;
228		for (uint64_t i = 0; i < numDevices; i++) {
229			if (k == vkGPU->device_id) {
230				vkGPU->driver = drivers[j];
231				vkGPU->device = deviceList[i];
232				ze_context_desc_t contextDescription = {};
233				contextDescription.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC;
234				res = zeContextCreate(vkGPU->driver, &contextDescription, &vkGPU->context);
235				if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_CONTEXT;
236
237				uint32_t queueGroupCount = 0;
238				res = zeDeviceGetCommandQueueGroupProperties(vkGPU->device, &queueGroupCount, 0);
239				if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
240
241				ze_command_queue_group_properties_t* cmdqueueGroupProperties = (ze_command_queue_group_properties_t*)malloc(queueGroupCount * sizeof(ze_command_queue_group_properties_t));
242				if (!cmdqueueGroupProperties) return VKFFT_ERROR_MALLOC_FAILED;
243				res = zeDeviceGetCommandQueueGroupProperties(vkGPU->device, &queueGroupCount, cmdqueueGroupProperties);
244				if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
245
246				uint32_t commandQueueID = -1;
247				for (uint32_t i = 0; i < queueGroupCount; ++i) {
248					if ((cmdqueueGroupProperties[i].flags && ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE) && (cmdqueueGroupProperties[i].flags && ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY)) {
249						commandQueueID = i;
250						break;
251					}
252				}
253				if (commandQueueID == -1) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
254				vkGPU->commandQueueID = commandQueueID;
255				ze_command_queue_desc_t commandQueueDescription = {};
256				commandQueueDescription.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC;
257				commandQueueDescription.ordinal = commandQueueID;
258				commandQueueDescription.priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
259				commandQueueDescription.mode = ZE_COMMAND_QUEUE_MODE_DEFAULT;
260				res = zeCommandQueueCreate(vkGPU->context, vkGPU->device, &commandQueueDescription, &vkGPU->commandQueue);
261				if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_CREATE_COMMAND_QUEUE;
262				free(cmdqueueGroupProperties);
263				k++;
264			}
265			else {
266				k++;
267			}
268		}
269
270		free(deviceList);
271	}
272	free(drivers);
273#endif
274
275	uint64_t isCompilerInitialized = 1;
276
277	switch (sample_id) {
278	case 0:
279	{
280		resFFT = sample_0_benchmark_VkFFT_single(vkGPU, file_output, output, isCompilerInitialized);
281		break;
282	}
283	case 1:
284	{
285		resFFT = sample_1_benchmark_VkFFT_double(vkGPU, file_output, output, isCompilerInitialized);
286		break;
287	}
288#if ((VKFFT_BACKEND==0)&&(VK_API_VERSION>10))
289	case 2:
290	{
291		resFFT = sample_2_benchmark_VkFFT_half(vkGPU, file_output, output, isCompilerInitialized);
292		break;
293	}
294#endif
295	case 3:
296	{
297		resFFT = sample_3_benchmark_VkFFT_single_3d(vkGPU, file_output, output, isCompilerInitialized);
298		break;
299	}
300	case 4:
301	{
302		resFFT = sample_4_benchmark_VkFFT_single_3d_zeropadding(vkGPU, file_output, output, isCompilerInitialized);
303		break;
304	}
305	case 5:
306	{
307		resFFT = sample_5_benchmark_VkFFT_single_disableReorderFourStep(vkGPU, file_output, output, isCompilerInitialized);
308		break;
309	}
310	case 6:
311	{
312		resFFT = sample_6_benchmark_VkFFT_single_r2c(vkGPU, file_output, output, isCompilerInitialized);
313		break;
314	}
315	case 7:
316	{
317		resFFT = sample_7_benchmark_VkFFT_single_Bluestein(vkGPU, file_output, output, isCompilerInitialized);
318		break;
319	}
320	case 8:
321	{
322		resFFT = sample_8_benchmark_VkFFT_double_Bluestein(vkGPU, file_output, output, isCompilerInitialized);
323		break;
324	}
325#if(VKFFT_BACKEND==0)
326	case 10:
327	{
328		resFFT = sample_10_benchmark_VkFFT_single_multipleBuffers(vkGPU, file_output, output, isCompilerInitialized);
329		break;
330	}
331#endif
332#ifdef USE_FFTW
333	case 11:
334	{
335		resFFT = sample_11_precision_VkFFT_single(vkGPU, file_output, output, isCompilerInitialized);
336		break;
337	}
338	case 12:
339	{
340		resFFT = sample_12_precision_VkFFT_double(vkGPU, file_output, output, isCompilerInitialized);
341		break;
342	}
343#if ((VKFFT_BACKEND==0)&&(VK_API_VERSION>10))
344	case 13:
345	{
346		resFFT = sample_13_precision_VkFFT_half(vkGPU, file_output, output, isCompilerInitialized);
347		break;
348	}
349#endif
350	case 14:
351	{
352		resFFT = sample_14_precision_VkFFT_single_nonPow2(vkGPU, file_output, output, isCompilerInitialized);
353		break;
354	}
355	case 15:
356	{
357		resFFT = sample_15_precision_VkFFT_single_r2c(vkGPU, file_output, output, isCompilerInitialized);
358		break;
359	}
360	case 16:
361	{
362		resFFT = sample_16_precision_VkFFT_single_dct(vkGPU, file_output, output, isCompilerInitialized);
363		break;
364	}
365	case 17:
366	{
367		resFFT = sample_17_precision_VkFFT_double_dct(vkGPU, file_output, output, isCompilerInitialized);
368		break;
369	}
370	case 18:
371	{
372		resFFT = sample_18_precision_VkFFT_double_nonPow2(vkGPU, file_output, output, isCompilerInitialized);
373		break;
374	}
375#endif
376	case 50:
377	{
378		resFFT = sample_50_convolution_VkFFT_single_1d_matrix(vkGPU, file_output, output, isCompilerInitialized);
379		break;
380	}
381	case 51:
382	{
383		resFFT = sample_51_convolution_VkFFT_single_3d_matrix_zeropadding_r2c(vkGPU, file_output, output, isCompilerInitialized);
384		break;
385	}
386	case 52:
387	{
388		resFFT = sample_52_convolution_VkFFT_single_2d_batched_r2c(vkGPU, file_output, output, isCompilerInitialized);
389		break;
390	}
391	case 110:
392	{
393		resFFT = sample_100_benchmark_VkFFT_single_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 1);
394		break;
395	}
396	case 120:
397	{
398		resFFT = sample_100_benchmark_VkFFT_single_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 2);
399		break;
400	}
401	case 130:
402	{
403		resFFT = sample_100_benchmark_VkFFT_single_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 3);
404		break;
405	}
406	case 140:
407	{
408		resFFT = sample_100_benchmark_VkFFT_single_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 4);
409		break;
410	}
411	case 111:
412	{
413		resFFT = sample_101_benchmark_VkFFT_double_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 1);
414		break;
415	}
416	case 121:
417	{
418		resFFT = sample_101_benchmark_VkFFT_double_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 2);
419		break;
420	}
421	case 131:
422	{
423		resFFT = sample_101_benchmark_VkFFT_double_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 3);
424		break;
425	}
426	case 141:
427	{
428		resFFT = sample_101_benchmark_VkFFT_double_nd_dct(vkGPU, file_output, output, isCompilerInitialized, 4);
429		break;
430	}
431	case 200: case 201:
432	{
433		resFFT = user_benchmark_VkFFT(vkGPU, file_output, output, isCompilerInitialized, userParams);
434		break;
435	}
436#if ((VKFFT_BACKEND==0)&&(VK_API_VERSION>10))
437	case 202:
438	{
439		resFFT = user_benchmark_VkFFT(vkGPU, file_output, output, isCompilerInitialized, userParams);
440		break;
441	}
442#endif
443	case 1000:
444	{
445		resFFT = sample_1000_VkFFT_single_2_4096(vkGPU, file_output, output, isCompilerInitialized);
446		break;
447	}
448	case 1001:
449	{
450		resFFT = sample_1001_benchmark_VkFFT_double_2_4096(vkGPU, file_output, output, isCompilerInitialized);
451		break;
452	}
453	case 1003:
454	{
455		resFFT = sample_1003_benchmark_VkFFT_single_3d_2_512(vkGPU, file_output, output, isCompilerInitialized);
456		break;
457	}
458	}
459#if(VKFFT_BACKEND==0)
460	vkDestroyFence(vkGPU->device, vkGPU->fence, NULL);
461	vkDestroyCommandPool(vkGPU->device, vkGPU->commandPool, NULL);
462	vkDestroyDevice(vkGPU->device, NULL);
463	DestroyDebugUtilsMessengerEXT(vkGPU, NULL);
464	vkDestroyInstance(vkGPU->instance, NULL);
465	glslang_finalize_process();//destroy compiler after use
466#elif(VKFFT_BACKEND==1)
467	res = cuCtxDestroy(vkGPU->context);
468#elif(VKFFT_BACKEND==2)
469	res = hipCtxDestroy(vkGPU->context);
470#elif(VKFFT_BACKEND==3)
471	res = clReleaseCommandQueue(vkGPU->commandQueue);
472	if (res != CL_SUCCESS) return VKFFT_ERROR_FAILED_TO_RELEASE_COMMAND_QUEUE;
473	clReleaseContext(vkGPU->context);
474#elif(VKFFT_BACKEND==4)
475	res = zeCommandQueueDestroy(vkGPU->commandQueue);
476	if (res != ZE_RESULT_SUCCESS) return VKFFT_ERROR_FAILED_TO_RELEASE_COMMAND_QUEUE;
477	res = zeContextDestroy(vkGPU->context);
478#endif
479
480	return resFFT;
481}
482
483bool findFlag(char** start, char** end, const std::string& flag) {
484	return (std::find(start, end, flag) != end);
485}
486char* getFlagValue(char** start, char** end, const std::string& flag)
487{
488	char** value = std::find(start, end, flag);
489	value++;
490	if (value != end)
491	{
492		return *value;
493	}
494	return 0;
495}
496int main(int argc, char* argv[])
497{
498	VkGPU vkGPU = {};
499#if(VKFFT_BACKEND==0)
500	vkGPU.enableValidationLayers = 0;
501#endif
502	bool file_output = false;
503	FILE* output = NULL;
504	int sscanf_res = 0;
505	if (findFlag(argv, argv + argc, "-h"))
506	{
507		//print help
508		int version = VkFFTGetVersion();
509		int version_decomposed[3];
510		version_decomposed[0] = version / 10000;
511		version_decomposed[1] = (version - version_decomposed[0] * 10000) / 100;
512		version_decomposed[2] = (version - version_decomposed[0] * 10000 - version_decomposed[1] * 100);
513		printf("VkFFT v%d.%d.%d (03-08-2022). Author: Tolmachev Dmitrii\n", version_decomposed[0], version_decomposed[1], version_decomposed[2]);
514#if (VKFFT_BACKEND==0)
515		printf("Vulkan backend\n");
516#elif (VKFFT_BACKEND==1)
517		printf("CUDA backend\n");
518#elif (VKFFT_BACKEND==2)
519		printf("HIP backend\n");
520#elif (VKFFT_BACKEND==3)
521		printf("OpenCL backend\n");
522#elif (VKFFT_BACKEND==4)
523		printf("Level Zero backend\n");
524#endif
525		printf("	-h: print help\n");
526		printf("	-devices: print the list of available device ids, used as -d argument\n");
527		printf("	-d X: select device (default 0)\n");
528		printf("	-o NAME: specify output file path\n");
529		printf("	-vkfft X: launch VkFFT sample X:\n");
530		printf("		0 - FFT + iFFT C2C benchmark 1D batched in single precision\n");
531		printf("		1 - FFT + iFFT C2C benchmark 1D batched in double precision LUT\n");
532#if ((VKFFT_BACKEND==0)&&(VK_API_VERSION>10))
533		printf("		2 - FFT + iFFT C2C benchmark 1D batched in half precision\n");
534#endif
535		printf("		3 - FFT + iFFT C2C multidimensional benchmark in single precision\n");
536		printf("		4 - FFT + iFFT C2C multidimensional benchmark in single precision, native zeropadding\n");
537		printf("		5 - FFT + iFFT C2C benchmark 1D batched in single precision, no reshuffling\n");
538		printf("		6 - FFT + iFFT R2C / C2R benchmark\n");
539		printf("		7 - FFT + iFFT C2C Bluestein benchmark in single precision\n");
540		printf("		8 - FFT + iFFT C2C Bluestein benchmark in double precision\n");
541#if (VKFFT_BACKEND==0)
542		printf("		10 - multiple buffer(4 by default) split version of benchmark 0\n");
543#endif
544#ifdef USE_FFTW
545#ifdef USE_cuFFT
546		printf("		11 - VkFFT / cuFFT / FFTW C2C precision test in single precision\n");
547		printf("		12 - VkFFT / cuFFT / FFTW C2C precision test in double precision\n");
548#if ((VKFFT_BACKEND==0)&&(VK_API_VERSION>10))
549		printf("		13 - VkFFT / cuFFT / FFTW C2C precision test in half precision\n");
550#endif
551		printf("		14 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in single precision\n");
552		printf("		15 - VkFFT / cuFFT / FFTW R2C+C2R precision test in single precision\n");
553		printf("		16 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in single precision\n");
554		printf("		17 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in double precision\n");
555		printf("		18 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in double precision\n");
556#elif USE_rocFFT
557		printf("		11 - VkFFT / rocFFT / FFTW C2C precision test in single precision\n");
558		printf("		12 - VkFFT / rocFFT / FFTW C2C precision test in double precision\n");
559#if ((VKFFT_BACKEND==0)&&(VK_API_VERSION>10))
560		printf("		13 - VkFFT / FFTW C2C precision test in half precision\n");
561#endif
562		printf("		14 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in single precision\n");
563		printf("		15 - VkFFT / rocFFT / FFTW R2C+C2R precision test in single precision\n");
564		printf("		16 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in single precision\n");
565		printf("		17 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in double precision\n");
566		printf("		18 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in double precision\n");
567#else
568		printf("		11 - VkFFT / FFTW C2C precision test in single precision\n");
569		printf("		12 - VkFFT / FFTW C2C precision test in double precision\n");
570#if ((VKFFT_BACKEND==0)&&(VK_API_VERSION>10))
571		printf("		13 - VkFFT / FFTW C2C precision test in half precision\n");
572#endif
573		printf("		14 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in single precision\n");
574		printf("		15 - VkFFT / FFTW R2C+C2R precision test in single precision\n");
575		printf("		16 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in single precision\n");
576		printf("		17 - VkFFT / FFTW R2R DCT-I, II, III and IV precision test in double precision\n");
577		printf("		18 - VkFFT / FFTW C2C radix 3 / 5 / 7 / 11 / 13 / Bluestein precision test in double precision\n");
578#endif
579#endif
580		printf("		50 - convolution example with identity kernel\n");
581		printf("		51 - zeropadding convolution example with identity kernel\n");
582		printf("		52 - batched convolution example with identity kernel\n");
583		printf("		110 - VkFFT FFT + iFFT R2R DCT-1 multidimensional benchmark in single precision\n");
584		printf("		111 - VkFFT FFT + iFFT R2R DCT-1 multidimensional benchmark in double precision\n");
585		printf("		120 - VkFFT FFT + iFFT R2R DCT-2 multidimensional benchmark in single precision\n");
586		printf("		121 - VkFFT FFT + iFFT R2R DCT-2 multidimensional benchmark in double precision\n");
587		printf("		130 - VkFFT FFT + iFFT R2R DCT-3 multidimensional benchmark in single precision\n");
588		printf("		131 - VkFFT FFT + iFFT R2R DCT-3 multidimensional benchmark in double precision\n");
589		printf("		140 - VkFFT FFT + iFFT R2R DCT-4 multidimensional benchmark in single precision\n");
590		printf("		141 - VkFFT FFT + iFFT R2R DCT-4 multidimensional benchmark in double precision\n");
591
592		printf("		1000 - FFT + iFFT C2C benchmark 1D batched in single precision: all supported systems from 2 to 4096\n");
593		printf("		1001 - FFT + iFFT C2C benchmark 1D batched in double precision: all supported systems from 2 to 4096\n");
594		printf("		1003 - FFT + iFFT C2C multidimensional benchmark in single precision: all supported cubes from 2 to 512\n");
595		printf("	-benchmark_vkfft: run VkFFT benchmark on a user-defined system:\n\
596		-X uint, -Y uint, -Z uint - FFT dimensions (default Y and Z are 1)\n");
597#if ((VKFFT_BACKEND==0)&&(VK_API_VERSION>10))
598		printf("\
599		-P uint - precision (0 - single, 1 - double, 2 - half) (default 0)\n");
600#else
601		printf("\
602		-P uint - precision (0 - single, 1 - double) (default 0)\n");
603#endif
604		printf("\
605		-B uint - number of batched systems (default 1)\n\
606		-N uint - number of consecutive FFT+iFFT iterations (default 1)\n\
607		-R2C uint - use R2C (0 - off, 1 - on) (default 0)\n\
608		-DCT uint - perform DCT (0 - off, else type: 1, 2, 3 or 4) (default 0)\n\
609		-save - save generated binaries\n\
610		-load - load previously generated binaries\n");
611#ifdef USE_cuFFT
612		printf("	-cufft X: launch cuFFT sample X:\n");
613		printf("		0 - FFT + iFFT C2C benchmark 1D batched in single precision\n");
614		printf("		1 - FFT + iFFT C2C benchmark 1D batched in double precision LUT\n");
615		printf("		2 - FFT + iFFT C2C benchmark 1D batched in half precision\n");
616		printf("		3 - FFT + iFFT C2C multidimensional benchmark in single precision\n");
617		printf("		6 - FFT + iFFT R2C / C2R benchmark\n");
618		printf("		7 - FFT + iFFT C2C big prime benchmark in single precision (similar to VkFFT Bluestein)\n");
619		printf("		8 - FFT + iFFT C2C big prime benchmark in double precision (similar to VkFFT Bluestein)\n");
620		printf("		1000 - FFT + iFFT C2C benchmark 1D batched in single precision: all supported systems from 2 to 4096\n");
621		printf("		1001 - FFT + iFFT C2C benchmark 1D batched in double precision: all supported systems from 2 to 4096\n");
622		printf("		1003 - FFT + iFFT C2C multidimensional benchmark in single precision: all supported cubes from 2 to 512\n");
623		printf("	-test: (or no -vkfft and -cufft keys) run vkfft benchmarks 0-6 and cufft benchmarks 0-6\n");
624		printf("	-benchmark_cufft: run cuFFT benchmark on a user-defined system:\n\
625		-X uint, -Y uint, -Z uint - FFT dimensions (default Y and Z are 1)\n\
626		-P uint - precision (0 - single, 1 - double) (default 0)\n\
627		-B uint - number of batched systems (default 1)\n\
628		-N uint - number of consecutive FFT+iFFT iterations (default 1)\n\
629		-R2C uint - use R2C (0 - off, 1 - on) (default 0)\n");
630#elif USE_rocFFT
631		printf("	-rocfft X: launch rocFFT sample X:\n");
632		printf("		0 - FFT + iFFT C2C benchmark 1D batched in single precision\n");
633		printf("		1 - FFT + iFFT C2C benchmark 1D batched in double precision LUT\n");
634		printf("		3 - FFT + iFFT C2C multidimensional benchmark in single precision\n");
635		printf("		6 - FFT + iFFT R2C / C2R benchmark\n");
636		printf("		7 - FFT + iFFT C2C big prime benchmark in single precision (similar to VkFFT Bluestein)\n");
637		printf("		8 - FFT + iFFT C2C big prime benchmark in double precision (similar to VkFFT Bluestein)\n");
638		printf("		1000 - FFT + iFFT C2C benchmark 1D batched in single precision: all supported systems from 2 to 4096\n");
639		printf("		1001 - FFT + iFFT C2C benchmark 1D batched in double precision: all supported systems from 2 to 4096\n");
640		printf("		1003 - FFT + iFFT C2C multidimensional benchmark in single precision: all supported cubes from 2 to 512\n");
641		printf("	-test: (or no -vkfft and -rocfft keys) run vkfft benchmarks 0-6 and rocfft benchmarks 0-6\n");
642		printf("	-benchmark_rocfft: run rocFFT benchmark on a user-defined system:\n\
643		-X uint, -Y uint, -Z uint - FFT dimensions (default Y and Z are 1)\n\
644		-P uint - precision (0 - single, 1 - double) (default 0)\n\
645		-B uint - number of batched systems (default 1)\n\
646		-N uint - number of consecutive FFT+iFFT iterations (default 1)\n\
647		-R2C uint - use R2C (0 - off, 1 - on) (default 0)\n");
648#else
649		printf("	-test: run vkfft benchmarks 0-6\n");
650		printf("	-cufft command is disabled\n");
651		printf("	-rocfft command is disabled\n");
652#endif
653		return 0;
654	}
655	if (findFlag(argv, argv + argc, "-devices"))
656	{
657		//print device list
658		VkFFTResult resFFT = devices_list();
659		return resFFT;
660	}
661	if (findFlag(argv, argv + argc, "-d"))
662	{
663		//select device_id
664		char* value = getFlagValue(argv, argv + argc, "-d");
665		if (value != 0) {
666			sscanf_res = sscanf(value, "%" PRIu64 "", &vkGPU.device_id);
667			if (sscanf_res <= 0) {
668				printf("sscanf failed\n");
669				return 1;
670			}
671		}
672		else {
673			printf("No device is selected with -d flag\n");
674			return 1;
675		}
676	}
677	if (findFlag(argv, argv + argc, "-o"))
678	{
679		//specify output file
680		char* value = getFlagValue(argv, argv + argc, "-o");
681		if (value != 0) {
682			file_output = true;
683			output = fopen(value, "a");
684		}
685		else {
686			printf("No output file is selected with -o flag\n");
687			return 1;
688		}
689	}
690	if (findFlag(argv, argv + argc, "-benchmark_vkfft") || findFlag(argv, argv + argc, "-benchmark_cufft") || findFlag(argv, argv + argc, "-benchmark_rocfft"))
691	{
692		//select sample_id
693		VkFFTUserSystemParameters userParams = {};
694		userParams.X = 1;
695		userParams.Y = 1;
696		userParams.Z = 1;
697		userParams.P = 0;
698		userParams.B = 1;
699		userParams.N = 1;
700		userParams.R2C = 0;
701		userParams.DCT = 0;
702		if (findFlag(argv, argv + argc, "-X"))
703		{
704			char* value = getFlagValue(argv, argv + argc, "-X");
705			if (value != 0) {
706				sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.X);
707				if (sscanf_res <= 0) {
708					printf("sscanf failed\n");
709					return 1;
710				}
711			}
712			else {
713				printf("No dimension is selected with -X flag\n");
714				return 1;
715			}
716		}
717		else {
718			printf("No -X flag is selected\n");
719			return 1;
720		}
721		if (findFlag(argv, argv + argc, "-Y"))
722		{
723			char* value = getFlagValue(argv, argv + argc, "-Y");
724			if (value != 0) {
725				sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.Y);
726				if (sscanf_res <= 0) {
727					printf("sscanf failed\n");
728					return 1;
729				}
730			}
731			else {
732				printf("No dimension is selected with -Y flag\n");
733				return 1;
734			}
735		}
736		if (findFlag(argv, argv + argc, "-Z"))
737		{
738			char* value = getFlagValue(argv, argv + argc, "-Z");
739			if (value != 0) {
740				sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.Z);
741				if (sscanf_res <= 0) {
742					printf("sscanf failed\n");
743					return 1;
744				}
745			}
746			else {
747				printf("No dimension is selected with -Z flag\n");
748				return 1;
749			}
750		}
751		if (findFlag(argv, argv + argc, "-P"))
752		{
753			char* value = getFlagValue(argv, argv + argc, "-P");
754			if (value != 0) {
755				sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.P);
756				if (sscanf_res <= 0) {
757					printf("sscanf failed\n");
758					return 1;
759				}
760			}
761			else {
762				printf("No precision is selected with -P flag\n");
763				return 1;
764			}
765		}
766		if (findFlag(argv, argv + argc, "-B"))
767		{
768			char* value = getFlagValue(argv, argv + argc, "-B");
769			if (value != 0) {
770				sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.B);
771				if (sscanf_res <= 0) {
772					printf("sscanf failed\n");
773					return 1;
774				}
775			}
776			else {
777				printf("No batch is selected with -B flag\n");
778				return 1;
779			}
780		}
781		if (findFlag(argv, argv + argc, "-N"))
782		{
783			char* value = getFlagValue(argv, argv + argc, "-N");
784			if (value != 0) {
785				sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.N);
786				if (sscanf_res <= 0) {
787					printf("sscanf failed\n");
788					return 1;
789				}
790			}
791			else {
792				printf("No number of iterations is selected with -N flag\n");
793				return 1;
794			}
795		}
796		if (findFlag(argv, argv + argc, "-R2C"))
797		{
798			char* value = getFlagValue(argv, argv + argc, "-R2C");
799			if (value != 0) {
800				sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.R2C);
801				if (sscanf_res <= 0) {
802					printf("sscanf failed\n");
803					return 1;
804				}
805			}
806			else {
807				printf("No R2C parameter is selected with -R2C flag\n");
808				return 1;
809			}
810		}
811		if (findFlag(argv, argv + argc, "-DCT"))
812		{
813			char* value = getFlagValue(argv, argv + argc, "-DCT");
814			if (value != 0) {
815				sscanf_res = sscanf(value, "%" PRIu64 "", &userParams.DCT);
816				if (sscanf_res <= 0) {
817					printf("sscanf failed\n");
818					return 1;
819				}
820			}
821			else {
822				printf("No DCT parameter is selected with -DCT flag\n");
823				return 1;
824			}
825		}
826		if (findFlag(argv, argv + argc, "-save"))
827		{
828			userParams.saveApplicationToString = 1;
829		}
830		if (findFlag(argv, argv + argc, "-load"))
831		{
832			userParams.loadApplicationFromString = 1;
833		}
834		if (findFlag(argv, argv + argc, "-benchmark_vkfft")) {
835			VkFFTResult resFFT = launchVkFFT(&vkGPU, 200 + userParams.P, file_output, output, &userParams);
836			if (resFFT != VKFFT_SUCCESS) return resFFT;
837		}
838		else {
839#ifdef USE_cuFFT
840			if (findFlag(argv, argv + argc, "-benchmark_cufft")) {
841				user_benchmark_cuFFT(file_output, output, (cuFFTUserSystemParameters*)(&userParams), (int)vkGPU.device_id);
842			}
843			return 0;
844#elif USE_rocFFT
845			if (findFlag(argv, argv + argc, "-benchmark_rocfft")) {
846				user_benchmark_rocFFT(file_output, output, (rocFFTUserSystemParameters*)(&userParams), (int)vkGPU.device_id);
847			}
848			return 0;
849#endif
850			return 1;
851		}
852		return 0;
853	}
854
855	if (findFlag(argv, argv + argc, "-vkfft"))
856	{
857		//select sample_id
858		char* value = getFlagValue(argv, argv + argc, "-vkfft");
859		if (value != 0) {
860			uint64_t sample_id = 0;
861			sscanf_res = sscanf(value, "%" PRIu64 "", &sample_id);
862			if (sscanf_res <= 0) {
863				printf("sscanf failed\n");
864				return 1;
865			}
866			VkFFTResult resFFT = launchVkFFT(&vkGPU, sample_id, file_output, output, 0);
867			if (resFFT != VKFFT_SUCCESS) return resFFT;
868		}
869		else {
870			printf("No sample is selected with -vkfft flag\n");
871			return 1;
872		}
873	}
874#ifdef USE_cuFFT
875	if (findFlag(argv, argv + argc, "-cufft"))
876	{
877		//select sample_id
878		char* value = getFlagValue(argv, argv + argc, "-cufft");
879		if (value != 0) {
880			uint64_t sample_id = 0;
881			sscanf_res = sscanf(value, "%" PRIu64 "", &sample_id);
882			if (sscanf_res <= 0) {
883				printf("sscanf failed\n");
884				return 1;
885			}
886			switch (sample_id) {
887			case 0:
888				sample_0_benchmark_cuFFT_single(file_output, output, (int)vkGPU.device_id);
889				break;
890			case 1:
891				sample_1_benchmark_cuFFT_double(file_output, output, (int)vkGPU.device_id);
892				break;
893			case 2:
894				sample_2_benchmark_cuFFT_half(file_output, output, (int)vkGPU.device_id);
895				break;
896			case 3:
897				sample_3_benchmark_cuFFT_single_3d(file_output, output, (int)vkGPU.device_id);
898				break;
899			case 6:
900				sample_6_benchmark_cuFFT_single_r2c(file_output, output, (int)vkGPU.device_id);
901				break;
902			case 7:
903				sample_7_benchmark_cuFFT_single_Bluestein(file_output, output, (int)vkGPU.device_id);
904				break;
905			case 8:
906				sample_8_benchmark_cuFFT_double_Bluestein(file_output, output, (int)vkGPU.device_id);
907				break;
908			case 1000:
909				sample_1000_benchmark_cuFFT_single_2_4096(file_output, output, (int)vkGPU.device_id);
910				break;
911			case 1001:
912				sample_1001_benchmark_cuFFT_double_2_4096(file_output, output, (int)vkGPU.device_id);
913				break;
914			case 1003:
915				sample_1003_benchmark_cuFFT_single_3d_2_512(file_output, output, (int)vkGPU.device_id);
916				break;
917			}
918		}
919		else {
920			printf("No cuFFT script is selected with -cufft flag\n");
921			return 1;
922		}
923	}
924#elif USE_rocFFT
925	if (findFlag(argv, argv + argc, "-rocfft"))
926	{
927		//select sample_id
928		char* value = getFlagValue(argv, argv + argc, "-rocfft");
929		if (value != 0) {
930			uint64_t sample_id = 0;
931			sscanf_res = sscanf(value, "%" PRIu64 "", &sample_id);
932			if (sscanf_res <= 0) {
933				printf("sscanf failed\n");
934				return 1;
935			}
936			switch (sample_id) {
937			case 0:
938				sample_0_benchmark_rocFFT_single(file_output, output, (int)vkGPU.device_id);
939				break;
940			case 1:
941				sample_1_benchmark_rocFFT_double(file_output, output, (int)vkGPU.device_id);
942				break;
943			case 3:
944				sample_3_benchmark_rocFFT_single_3d(file_output, output, (int)vkGPU.device_id);
945				break;
946			case 6:
947				sample_6_benchmark_rocFFT_single_r2c(file_output, output, (int)vkGPU.device_id);
948				break;
949			case 7:
950				sample_7_benchmark_rocFFT_single_Bluestein(file_output, output, (int)vkGPU.device_id);
951				break;
952			case 8:
953				sample_8_benchmark_rocFFT_double_Bluestein(file_output, output, (int)vkGPU.device_id);
954				break;
955			case 1000:
956				sample_1000_benchmark_rocFFT_single_2_4096(file_output, output, (int)vkGPU.device_id);
957				break;
958			case 1001:
959				sample_1001_benchmark_rocFFT_double_2_4096(file_output, output, (int)vkGPU.device_id);
960				break;
961			case 1003:
962				sample_1003_benchmark_rocFFT_single_3d_2_512(file_output, output, (int)vkGPU.device_id);
963				break;
964			}
965		}
966		else {
967			printf("No rocFFT script is selected with -rocfft flag\n");
968			return 1;
969		}
970	}
971#endif
972	if ((findFlag(argv, argv + argc, "-test")) || ((!findFlag(argv, argv + argc, "-cufft")) && (!findFlag(argv, argv + argc, "-rocfft")) && (!findFlag(argv, argv + argc, "-vkfft"))))
973	{
974		if (output == NULL) {
975			file_output = true;
976			output = fopen("result.txt", "a");
977		}
978		for (uint64_t i = 0; i < 9; i++) {
979#if((VKFFT_BACKEND>0) || (VK_API_VERSION == 10))
980			if (i == 2) i++;
981#endif
982			VkFFTResult resFFT = launchVkFFT(&vkGPU, i, file_output, output, 0);
983			if (resFFT != VKFFT_SUCCESS) return resFFT;
984		}
985#ifdef USE_cuFFT
986		sample_0_benchmark_cuFFT_single(file_output, output, (int)vkGPU.device_id);
987		sample_1_benchmark_cuFFT_double(file_output, output, (int)vkGPU.device_id);
988		sample_2_benchmark_cuFFT_half(file_output, output, (int)vkGPU.device_id);
989		sample_3_benchmark_cuFFT_single_3d(file_output, output, (int)vkGPU.device_id);
990		sample_6_benchmark_cuFFT_single_r2c(file_output, output, (int)vkGPU.device_id);
991		sample_7_benchmark_cuFFT_single_Bluestein(file_output, output, (int)vkGPU.device_id);
992		sample_8_benchmark_cuFFT_double_Bluestein(file_output, output, (int)vkGPU.device_id);
993#elif USE_rocFFT
994		sample_0_benchmark_rocFFT_single(file_output, output, (int)vkGPU.device_id);
995		sample_1_benchmark_rocFFT_double(file_output, output, (int)vkGPU.device_id);
996		sample_3_benchmark_rocFFT_single_3d(file_output, output, (int)vkGPU.device_id);
997		sample_6_benchmark_rocFFT_single_r2c(file_output, output, (int)vkGPU.device_id);
998		sample_7_benchmark_rocFFT_single_Bluestein(file_output, output, (int)vkGPU.device_id);
999		sample_8_benchmark_rocFFT_double_Bluestein(file_output, output, (int)vkGPU.device_id);
1000#endif
1001	}
1002	return 0;
1003}