MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / main

Function main

examples/cpp/swin/swin_example.cc:323–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323int main(int argc, char* argv[])
324{
325 struct cudaDeviceProp prop;
326 check_cuda_error(cudaGetDeviceProperties(&prop, 0));
327 if (argc != 7) {
328 FT_LOG_ERROR(
329 "swin_example version(1/2) data_type(0/1, fp32/fp16) model_type(0-3) window_size(7/8/12/16/24) img_size(192/224/256/384) batch_size");
330 FT_LOG_INFO("model_type:");
331 FT_LOG_INFO("0: tiny");
332 FT_LOG_INFO("1: small");
333 FT_LOG_INFO("2: base");
334 FT_LOG_INFO("3: large");
335 FT_LOG_INFO("e.g., ./bin/swin_example 1 1 0 7 224 32");
336 return 0;
337 }
338 FT_LOG_INFO("Device %s", prop.name);
339
340 int version = atoi(argv[1]);
341 FtCudaDataType data_type = static_cast<FtCudaDataType>(atoi(argv[2])); // 0: fp32, 1: fp16
342 int model_type = atoi(argv[3]);
343 int window_size = atoi(argv[4]);
344 int img_size = atoi(argv[5]);
345 int batch = atoi(argv[6]);
346
347 if (version != 1 && version != 2) {
348 FT_LOG_ERROR("version is not supported");
349 return -1;
350 }
351
352 if (data_type == FP16) {
353 test<half>(version, model_type, window_size, img_size, batch);
354 }
355 else if (data_type == FP32) {
356 test<float>(version, model_type, window_size, img_size, batch);
357 }
358 else {
359 FT_LOG_ERROR("data_type is not supported");
360 return 0;
361 }
362}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected