mirror of https://github.com/Jittor/Jittor
polish gcc error
This commit is contained in:
parent
8243ebc5b5
commit
e37dd420d9
|
@ -8,7 +8,7 @@
|
|||
# This file is subject to the terms and conditions defined in
|
||||
# file 'LICENSE.txt', which is part of this source code package.
|
||||
# ***************************************************************
|
||||
__version__ = '1.2.2.58'
|
||||
__version__ = '1.2.2.59'
|
||||
from . import lock
|
||||
with lock.lock_scope():
|
||||
ori_int = int
|
||||
|
|
|
@ -166,7 +166,7 @@ inline JK& operator<<(JK& jk, int64 c) {
|
|||
return jk << JK::hex(c);
|
||||
}
|
||||
|
||||
inline JK& operator<<(JK& jk, long long c) {
|
||||
inline JK& operator<<(JK& jk, long long int c) {
|
||||
return jk << (int64)c;
|
||||
}
|
||||
|
||||
|
|
|
@ -308,16 +308,23 @@ int system_popen(const char* cmd) {
|
|||
cmd2 += " 2>&1 ";
|
||||
FILE *ptr = popen(cmd2.c_str(), "r");
|
||||
if (!ptr) return -1;
|
||||
int64 len=0;
|
||||
while (fgets(buf, BUFSIZ, ptr) != NULL) {
|
||||
len += strlen(buf);
|
||||
puts(buf);
|
||||
}
|
||||
return pclose(ptr);
|
||||
auto ret = pclose(ptr);
|
||||
if (len<10 && ret) {
|
||||
// maybe overcommit
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void system_with_check(const char* cmd) {
|
||||
auto ret = system_popen(cmd);
|
||||
CHECK(ret>=0 && ret<256) << "Run cmd failed:" << cmd <<
|
||||
"\nreturn -1. This might be an overcommit issue or out of memory."
|
||||
CHECK(ret>=0 && ret<=256) << "Run cmd failed:" << cmd <<
|
||||
"\nreturn ">> ret >> ". This might be an overcommit issue or out of memory."
|
||||
<< "Try : sudo sysctl vm.overcommit_memory=1";
|
||||
CHECKop(ret,==,0) << "Run cmd failed:" << cmd;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue