diff --git a/source/source_base/module_device/device.h b/source/source_base/module_device/device.h index 453c304bb27..d6ffd5f3f7e 100644 --- a/source/source_base/module_device/device.h +++ b/source/source_base/module_device/device.h @@ -117,18 +117,6 @@ class DeviceContext { */ void init(); - /** - * @brief Check if the DeviceContext has been initialized - * @return true if init() has been called successfully - */ - bool is_initialized() const { return initialized_; } - - /** - * @brief Check if GPU is enabled and available - * @return true if GPU device is bound and usable - */ - bool is_gpu_enabled() const { return gpu_enabled_; } - /** * @brief Get the bound GPU device ID * @return Device ID (0-based), or -1 if not initialized @@ -147,36 +135,6 @@ class DeviceContext { */ int get_local_rank() const { return local_rank_; } - /** - * @brief Set the device type (CpuDevice, GpuDevice, or DspDevice) - * @param type The device type - */ - void set_device_type(AbacusDevice_t type) { device_type_ = type; } - - /** - * @brief Get the device type - * @return AbacusDevice_t The device type - */ - AbacusDevice_t get_device_type() const { return device_type_; } - - /** - * @brief Check if the device is CPU - * @return true if the device is CPU - */ - bool is_cpu() const { return device_type_ == CpuDevice; } - - /** - * @brief Check if the device is GPU - * @return true if the device is GPU - */ - bool is_gpu() const { return device_type_ == GpuDevice; } - - /** - * @brief Check if the device is DSP - * @return true if the device is DSP - */ - bool is_dsp() const { return device_type_ == DspDevice; } - // Disable copy and assignment DeviceContext(const DeviceContext&) = delete; DeviceContext& operator=(const DeviceContext&) = delete; @@ -190,21 +148,9 @@ class DeviceContext { int device_id_ = -1; int device_count_ = 0; int local_rank_ = 0; - AbacusDevice_t device_type_ = CpuDevice; - std::mutex init_mutex_; }; -/** - * @brief Get the device type enum from DeviceContext (runtime version). - * @param ctx Pointer to DeviceContext - * @return AbacusDevice_t enum value - */ -inline AbacusDevice_t get_device_type(const DeviceContext* ctx) -{ - return ctx->get_device_type(); -} - } // end of namespace base_device #endif // MODULE_DEVICE_H_ diff --git a/source/source_base/module_device/device_helpers.h b/source/source_base/module_device/device_helpers.h index 2870eea2d78..314f1525ed7 100644 --- a/source/source_base/module_device/device_helpers.h +++ b/source/source_base/module_device/device_helpers.h @@ -21,13 +21,6 @@ namespace base_device // Forward declaration class DeviceContext; -/** - * @brief Get the device type enum from DeviceContext (runtime version). - * @param ctx Pointer to DeviceContext - * @return AbacusDevice_t enum value - */ -inline AbacusDevice_t get_device_type(const DeviceContext* ctx); - /** * @brief Get the device type enum for a given device type (compile-time version). * @tparam Device The device type (DEVICE_CPU or DEVICE_GPU) diff --git a/source/source_main/driver.cpp b/source/source_main/driver.cpp index 8727d0d4085..93e98ee461d 100644 --- a/source/source_main/driver.cpp +++ b/source/source_main/driver.cpp @@ -130,6 +130,10 @@ void Driver::reading() #endif #ifdef __DSP + if (PARAM.inp.dsp_count <= 0) + { + ModuleBase::WARNING_QUIT("driver", "dsp_count must be > 0"); + } base_device::memory::set_dsp_cluster_id(GlobalV::MY_RANK % PARAM.inp.dsp_count); BlasConnector::set_dsp_cluster_id(GlobalV::MY_RANK % PARAM.inp.dsp_count); #endif