update cmake/external_libs/sentencepiece.cmake to solve windows problem

Signed-off-by: zhoufeng <zhoufeng54@huawei.com>
This commit is contained in:
zhoufeng 2021-07-18 02:42:19 +08:00 committed by xiefangqi
parent a21f471716
commit dda1bcc7e2
5 changed files with 17 additions and 12 deletions

View File

@ -15,7 +15,7 @@ if(WIN32)
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=ON
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=ON -DSPM_ENABLE_SHARED=OFF
MD5 ${MD5}
)
else()

View File

@ -30,13 +30,10 @@ std::optional<std::string> Common::GetRealPath(const std::string &input_path) {
if (input_path.length() >= PATH_MAX) {
MS_LOG(EXCEPTION) << "The length of path: " << input_path << " exceeds limit: " << PATH_MAX;
}
#if defined(SYSTEM_ENV_POSIX)
size_t path_split_pos = input_path.find_last_of('/');
#elif defined(SYSTEM_ENV_WINDOWS)
size_t path_split_pos = input_path.find_last_of('\\');
#else
MS_LOG(EXCEPTION) << "Unsupported platform.";
#endif
auto path_split_pos = input_path.find_last_of('/');
if (path_split_pos == std::string::npos) {
path_split_pos = input_path.find_last_of('\\');
}
// get real path
char real_path[PATH_MAX] = {0};
// input_path is dir + file_name

View File

@ -17,6 +17,7 @@ The configuration module provides various functions to set and get the supported
configuration parameters, and read a configuration file.
"""
import os
import platform
import random
import time
import numpy
@ -428,6 +429,10 @@ def get_enable_shared_mem():
>>> # Get the flag of shared memory feature.
>>> shared_mem_flag = ds.config.get_enable_shared_mem()
"""
# For windows we forbid shared mem function temporarily
if platform.system().lower() == 'windows':
logger.warning("For windows we forbid shared mem function temporarily.")
return False
return _config.get_enable_shared_mem()

View File

@ -2150,7 +2150,8 @@ class BatchDataset(Dataset):
res_q_list = []
# Register clean zombie subprocesses signal here
signal.signal(signal.SIGCHLD, wait_child_processes)
if platform.system().lower() != "windows":
signal.signal(signal.SIGCHLD, wait_child_processes)
# If user didn't specify num_parallel_workers, set it to default
if self.num_parallel_workers is not None:
@ -2648,7 +2649,8 @@ class MapDataset(Dataset):
if callable_list:
# Register clean zombie subprocesses signal here
signal.signal(signal.SIGCHLD, wait_child_processes)
if platform.system().lower() != "windows":
signal.signal(signal.SIGCHLD, wait_child_processes)
# Construct pool with the callable list
# The callable list and _pyfunc_worker_init are used to pass lambda function in to subprocesses
@ -3594,7 +3596,8 @@ class SamplerFn:
# Event for end of epoch
if multi_process is True:
# Register clean zombie subprocesses signal here
signal.signal(signal.SIGCHLD, wait_child_processes)
if platform.system().lower() != "windows":
signal.signal(signal.SIGCHLD, wait_child_processes)
try:
self.eof = multiprocessing.Event()

View File

@ -113,7 +113,7 @@ def test_e2e_dump():
run_e2e_dump()
@pytest.mark.level0
@pytest.mark.level1
@pytest.mark.platform_arm_ascend_training
@pytest.mark.platform_x86_ascend_training
@pytest.mark.env_onecard