Skip to content

Commit

Permalink
Update sdtype_adapter.cpp putenv to _putenv POSIX
Browse files Browse the repository at this point in the history
  • Loading branch information
YellowRoseCx authored Apr 12, 2024
1 parent a4de003 commit c4c4448
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions otherarch/sdcpp/sdtype_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ bool sdtype_load_model(const sd_load_model_inputs inputs) {
//duplicated from expose.cpp
int cl_parseinfo = inputs.clblast_info; //first digit is whether configured, second is platform, third is devices
std::string usingclblast = "GGML_OPENCL_CONFIGURED="+std::to_string(cl_parseinfo>0?1:0);
putenv((char*)usingclblast.c_str());
_putenv((char*)usingclblast.c_str());
cl_parseinfo = cl_parseinfo%100; //keep last 2 digits
int platform = cl_parseinfo/10;
int devices = cl_parseinfo%10;
sdplatformenv = "GGML_OPENCL_PLATFORM="+std::to_string(platform);
sddeviceenv = "GGML_OPENCL_DEVICE="+std::to_string(devices);
putenv((char*)sdplatformenv.c_str());
putenv((char*)sddeviceenv.c_str());
_putenv((char*)sdplatformenv.c_str());
_putenv((char*)sddeviceenv.c_str());
std::string vulkan_info_raw = inputs.vulkan_info;
std::string vulkan_info_str = "";
for (size_t i = 0; i < vulkan_info_raw.length(); ++i) {
Expand All @@ -176,7 +176,7 @@ bool sdtype_load_model(const sd_load_model_inputs inputs) {
vulkan_info_str = "0";
}
sdvulkandeviceenv = "GGML_VK_VISIBLE_DEVICES="+vulkan_info_str;
putenv((char*)sdvulkandeviceenv.c_str());
_putenv((char*)sdvulkandeviceenv.c_str());

sd_params = new SDParams();
sd_params->model_path = inputs.model_filename;
Expand Down

0 comments on commit c4c4448

Please sign in to comment.