mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
warn when requesting decompression with multiple threads
restore #2918 fix
This commit is contained in:
@ -822,15 +822,6 @@ static unsigned init_nbWorkers(void) {
|
|||||||
CLEAN_RETURN(1); \
|
CLEAN_RETURN(1); \
|
||||||
} } }
|
} } }
|
||||||
|
|
||||||
#define NEXT_INT32(_vari32) { \
|
|
||||||
const char* __nb; \
|
|
||||||
NEXT_FIELD(__nb); \
|
|
||||||
_vari32 = (int)readU32FromChar(&__nb); \
|
|
||||||
if(*__nb != 0) { \
|
|
||||||
errorOut("error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed"); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NEXT_UINT32(_varu32) { \
|
#define NEXT_UINT32(_varu32) { \
|
||||||
const char* __nb; \
|
const char* __nb; \
|
||||||
NEXT_FIELD(__nb); \
|
NEXT_FIELD(__nb); \
|
||||||
@ -887,7 +878,8 @@ int main(int argCount, const char* argv[])
|
|||||||
removeSrcFile = 0,
|
removeSrcFile = 0,
|
||||||
cLevel = init_cLevel(),
|
cLevel = init_cLevel(),
|
||||||
ultra = 0,
|
ultra = 0,
|
||||||
cLevelLast = MINCLEVEL - 1; /* for benchmark range */
|
cLevelLast = MINCLEVEL - 1, /* for benchmark range */
|
||||||
|
setThreads_non1 = 0;
|
||||||
unsigned nbWorkers = init_nbWorkers();
|
unsigned nbWorkers = init_nbWorkers();
|
||||||
ZSTD_ParamSwitch_e mmapDict = ZSTD_ps_auto;
|
ZSTD_ParamSwitch_e mmapDict = ZSTD_ps_auto;
|
||||||
ZSTD_ParamSwitch_e useRowMatchFinder = ZSTD_ps_auto;
|
ZSTD_ParamSwitch_e useRowMatchFinder = ZSTD_ps_auto;
|
||||||
@ -1090,7 +1082,7 @@ int main(int argCount, const char* argv[])
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (longCommandWArg(&argument, "--threads")) { NEXT_UINT32(nbWorkers); continue; }
|
if (longCommandWArg(&argument, "--threads")) { NEXT_UINT32(nbWorkers); setThreads_non1 = (nbWorkers != 1); continue; }
|
||||||
if (longCommandWArg(&argument, "--memlimit")) { NEXT_UINT32(memLimit); continue; }
|
if (longCommandWArg(&argument, "--memlimit")) { NEXT_UINT32(memLimit); continue; }
|
||||||
if (longCommandWArg(&argument, "--memory")) { NEXT_UINT32(memLimit); continue; }
|
if (longCommandWArg(&argument, "--memory")) { NEXT_UINT32(memLimit); continue; }
|
||||||
if (longCommandWArg(&argument, "--memlimit-decompress")) { NEXT_UINT32(memLimit); continue; }
|
if (longCommandWArg(&argument, "--memlimit-decompress")) { NEXT_UINT32(memLimit); continue; }
|
||||||
@ -1297,6 +1289,7 @@ int main(int argCount, const char* argv[])
|
|||||||
case 'T':
|
case 'T':
|
||||||
argument++;
|
argument++;
|
||||||
nbWorkers = readU32FromChar(&argument);
|
nbWorkers = readU32FromChar(&argument);
|
||||||
|
setThreads_non1 = (nbWorkers != 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dictionary Selection level */
|
/* Dictionary Selection level */
|
||||||
@ -1341,6 +1334,9 @@ int main(int argCount, const char* argv[])
|
|||||||
DISPLAYLEVEL(3, WELCOME_MESSAGE);
|
DISPLAYLEVEL(3, WELCOME_MESSAGE);
|
||||||
|
|
||||||
#ifdef ZSTD_MULTITHREAD
|
#ifdef ZSTD_MULTITHREAD
|
||||||
|
if ((operation==zom_decompress) && (setThreads_non1)) {
|
||||||
|
DISPLAYLEVEL(2, "Warning : decompression does not support multi-threading\n");
|
||||||
|
}
|
||||||
if ((nbWorkers==NBWORKERS_AUTOCPU) && (!singleThread)) {
|
if ((nbWorkers==NBWORKERS_AUTOCPU) && (!singleThread)) {
|
||||||
/* automatically set # workers based on # of reported cpu cores */
|
/* automatically set # workers based on # of reported cpu cores */
|
||||||
if (defaultLogicalCores) {
|
if (defaultLogicalCores) {
|
||||||
|
@ -10,3 +10,13 @@ zstd -T0 -f file -q ; zstd -t file.zst
|
|||||||
zstd -T0 --auto-threads=logical -f file -q ; zstd -t file.zst
|
zstd -T0 --auto-threads=logical -f file -q ; zstd -t file.zst
|
||||||
zstd -T0 --auto-threads=physical -f file -q ; zstd -t file.zst
|
zstd -T0 --auto-threads=physical -f file -q ; zstd -t file.zst
|
||||||
zstd -T0 --jobsize=1M -f file -q ; zstd -t file.zst
|
zstd -T0 --jobsize=1M -f file -q ; zstd -t file.zst
|
||||||
|
|
||||||
|
# multi-thread decompression warning test
|
||||||
|
zstd -T0 -f file -q ; zstd -t file.zst; zstd -T0 -d file.zst -o file3
|
||||||
|
zstd -T0 -f file -q ; zstd -t file.zst; zstd -T2 -d file.zst -o file4
|
||||||
|
# setting multi-thread via environment variable does not trigger decompression warning
|
||||||
|
zstd -T0 -f file -q ; zstd -t file.zst; ZSTD_NBTHREADS=0 zstd -df file.zst -o file3
|
||||||
|
zstd -T0 -f file -q ; zstd -t file.zst; ZSTD_NBTHREADS=2 zstd -df file.zst -o file4
|
||||||
|
# setting nbThreads==1 does not trigger decompression warning
|
||||||
|
zstd -T0 -f file -q ; zstd -t file.zst; zstd -T1 -df file.zst -o file3
|
||||||
|
zstd -T0 -f file -q ; zstd -t file.zst; zstd -T2 -T1 -df file.zst -o file4
|
||||||
|
@ -5,3 +5,17 @@ file.zst : 65537 bytes
|
|||||||
file.zst : 65537 bytes
|
file.zst : 65537 bytes
|
||||||
file.zst : 65537 bytes
|
file.zst : 65537 bytes
|
||||||
file.zst : 65537 bytes
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
Warning : decompression does not support multi-threading
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
Warning : decompression does not support multi-threading
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
file.zst : 65537 bytes
|
||||||
|
Reference in New Issue
Block a user