| 140 | } |
| 141 | |
| 142 | string getDeviceInfo() noexcept { |
| 143 | ostringstream info; |
| 144 | info << "ArrayFire v" << AF_VERSION << " (oneAPI, " << get_system() |
| 145 | << ", build " << AF_REVISION << ")\n"; |
| 146 | |
| 147 | try { |
| 148 | DeviceManager& devMngr = DeviceManager::getInstance(); |
| 149 | |
| 150 | common::lock_guard_t lock(devMngr.deviceMutex); |
| 151 | unsigned nDevices = 0; |
| 152 | for (auto& device : devMngr.mDevices) { |
| 153 | // const Platform platform(device->getInfo<CL_DEVICE_PLATFORM>()); |
| 154 | |
| 155 | string dstr = device->get_info<sycl::info::device::name>(); |
| 156 | bool show_braces = |
| 157 | (static_cast<unsigned>(getActiveDeviceId()) == nDevices); |
| 158 | |
| 159 | string id = (show_braces ? string("[") : "-") + |
| 160 | to_string(nDevices) + (show_braces ? string("]") : "-"); |
| 161 | size_t msize = |
| 162 | device->get_info<sycl::info::device::global_mem_size>(); |
| 163 | info << id << " " << getPlatformName(*device) << ": " << ltrim(dstr) |
| 164 | << ", " << msize / 1048576 << " MB"; |
| 165 | info << " ("; |
| 166 | if (device->has(aspect::fp64)) { info << "fp64 "; } |
| 167 | if (device->has(aspect::fp16) && |
| 168 | device->get_info<sycl::info::device::native_vector_width_half>() != 0) |
| 169 | { info << "fp16 "; } |
| 170 | info << "\b)"; |
| 171 | #ifndef NDEBUG |
| 172 | info << " -- "; |
| 173 | string devVersion = device->get_info<sycl::info::device::version>(); |
| 174 | string driVersion = |
| 175 | device->get_info<sycl::info::device::driver_version>(); |
| 176 | info << devVersion; |
| 177 | info << " -- Device driver " << driVersion; |
| 178 | info << " -- Unified Memory (" |
| 179 | << (isHostUnifiedMemory(*device) ? "True" : "False") << ")"; |
| 180 | #endif |
| 181 | info << endl; |
| 182 | |
| 183 | nDevices++; |
| 184 | } |
| 185 | } catch (const AfError& err) { |
| 186 | UNUSED(err); |
| 187 | info << "No platforms found.\n"; |
| 188 | // Don't throw an exception here. Info should pass even if the system |
| 189 | // doesn't have the correct drivers installed. |
| 190 | } |
| 191 | return info.str(); |
| 192 | } |
| 193 | |
| 194 | string getPlatformName(const sycl::device& device) { |
| 195 | std::string platStr = |
nothing calls this directly
no test coverage detected