Browse Source

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

Signed-off-by: zhoufeng <zhoufeng54@huawei.com>
r1.3-patch
zhoufeng xiefangqi 4 years ago
parent
commit
dda1bcc7e2
5 changed files with 17 additions and 12 deletions
  1. +1
    -1
      cmake/external_libs/sentencepiece.cmake
  2. +4
    -7
      mindspore/ccsrc/debug/common.cc
  3. +5
    -0
      mindspore/dataset/core/config.py
  4. +6
    -3
      mindspore/dataset/engine/datasets.py
  5. +1
    -1
      tests/st/dump/test_data_dump.py

+ 1
- 1
cmake/external_libs/sentencepiece.cmake 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()


+ 4
- 7
mindspore/ccsrc/debug/common.cc 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


+ 5
- 0
mindspore/dataset/core/config.py 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()




+ 6
- 3
mindspore/dataset/engine/datasets.py 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()


+ 1
- 1
tests/st/dump/test_data_dump.py 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


Loading…
Cancel
Save