Skip to content

Commit

Permalink
add PD_ConfigEnableCustomDevice new param (PaddlePaddle#63702)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly-Zhe authored and co63oc committed Apr 25, 2024
1 parent c8db135 commit e7a9683
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions paddle/fluid/inference/capi_exp/pd_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ int32_t PD_ConfigXpuDeviceId(__pd_keep PD_Config* pd_config) {

void PD_ConfigEnableCustomDevice(__pd_keep PD_Config* pd_config,
char* device_type,
int32_t device_id) {
int32_t device_id,
PD_PrecisionType precision) {
CHECK_AND_CONVERT_PD_CONFIG;
config->EnableCustomDevice(device_type, device_id);
config->EnableCustomDevice(
device_type, device_id, ConvertToCxxPrecisionType(precision));
}
PD_Bool PD_ConfigUseCustomDevice(__pd_keep PD_Config* pd_config) {
CHECK_AND_CONVERT_PD_CONFIG;
Expand Down
5 changes: 4 additions & 1 deletion paddle/fluid/inference/capi_exp/pd_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ PADDLE_CAPI_EXPORT extern int32_t PD_ConfigXpuDeviceId(
/// \param[in] device_id device_id the custom device card to use.
///
PADDLE_CAPI_EXPORT extern void PD_ConfigEnableCustomDevice(
__pd_keep PD_Config* pd_config, char* device_type, int32_t device_id);
__pd_keep PD_Config* pd_config,
char* device_type,
int32_t device_id,
PD_PrecisionType precision);
///
/// \brief A boolean state telling whether the custom device is turned on.
///
Expand Down

0 comments on commit e7a9683

Please sign in to comment.