File tree Expand file tree Collapse file tree 2 files changed +40
-28
lines changed
Expand file tree Collapse file tree 2 files changed +40
-28
lines changed Original file line number Diff line number Diff line change @@ -56,20 +56,26 @@ void dump_device_info (const device & Device)
5656 << Device.get_info <info::device::profile>() << ' \n ' ;
5757 ss << std::setw (4 ) << " " << std::left << std::setw (16 ) << " Device type" ;
5858
59- try {
60- if (Device.has (aspect::accelerator))
61- ss << " accelerator" << ' \n ' ;
62- else if (Device.has (aspect::cpu))
63- ss << " cpu" << ' \n ' ;
64- else if (Device.has (aspect::custom))
65- ss << " custom" << ' \n ' ;
66- else if (Device.has (aspect::gpu))
67- ss << " gpu" << ' \n ' ;
68- else if (Device.has (aspect::host))
69- ss << " host" << ' \n ' ;
70- } catch (runtime_error re) {
71- // \todo handle errors
72- ss << " unknown\n " ;
59+ auto devTy = Device.get_info <info::device::device_type>();
60+ switch (devTy)
61+ {
62+ case info::device_type::cpu:
63+ ss << " cpu" << ' \n ' ;
64+ break ;
65+ case info::device_type::gpu:
66+ ss << " gpu" << ' \n ' ;
67+ break ;
68+ case info::device_type::accelerator:
69+ ss << " accelerator" << ' \n ' ;
70+ break ;
71+ case info::device_type::custom:
72+ ss << " custom" << ' \n ' ;
73+ break ;
74+ case info::device_type::host:
75+ ss << " host" << ' \n ' ;
76+ break ;
77+ default :
78+ ss << " unknown" << ' \n ' ;
7379 }
7480
7581 std::cout << ss.str ();
Original file line number Diff line number Diff line change @@ -90,20 +90,26 @@ void DPPLPlatform_DumpInfo ()
9090 ss << std::setw (8 ) << " " << std::left << std::setw (20 )
9191 << " Device type" ;
9292
93- try {
94- if (devices[dn].has (aspect::accelerator))
95- ss << " accelerator" << ' \n ' ;
96- else if (devices[dn].has (aspect::cpu))
97- ss << " cpu" << ' \n ' ;
98- else if (devices[dn].has (aspect::custom))
99- ss << " custom" << ' \n ' ;
100- else if (devices[dn].has (aspect::gpu))
101- ss << " gpu" << ' \n ' ;
102- else if (devices[dn].has (aspect::host))
103- ss << " host" << ' \n ' ;
104- } catch (runtime_error re) {
105- // \todo handle errors
106- ss << " unknown\n " ;
93+ auto devTy = devices[dn].get_info <info::device::device_type>();
94+ switch (devTy)
95+ {
96+ case info::device_type::cpu:
97+ ss << " cpu" << ' \n ' ;
98+ break ;
99+ case info::device_type::gpu:
100+ ss << " gpu" << ' \n ' ;
101+ break ;
102+ case info::device_type::accelerator:
103+ ss << " accelerator" << ' \n ' ;
104+ break ;
105+ case info::device_type::custom:
106+ ss << " custom" << ' \n ' ;
107+ break ;
108+ case info::device_type::host:
109+ ss << " host" << ' \n ' ;
110+ break ;
111+ default :
112+ ss << " unknown" << ' \n ' ;
107113 }
108114 }
109115
You can’t perform that action at this time.
0 commit comments