Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions source/source_base/module_device/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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_
7 changes: 0 additions & 7 deletions source/source_base/module_device/device_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions source/source_main/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
Cstandardlib marked this conversation as resolved.
Expand Down
Loading