mirror of https://github.com/Jittor/Jittor
polish exit cleanup
This commit is contained in:
parent
7349284663
commit
aa749dd0e0
|
@ -9,7 +9,7 @@
|
||||||
# file 'LICENSE.txt', which is part of this source code package.
|
# file 'LICENSE.txt', which is part of this source code package.
|
||||||
# ***************************************************************
|
# ***************************************************************
|
||||||
|
|
||||||
__version__ = '1.2.3.94'
|
__version__ = '1.2.3.95'
|
||||||
from jittor_utils import lock
|
from jittor_utils import lock
|
||||||
with lock.lock_scope():
|
with lock.lock_scope():
|
||||||
ori_int = int
|
ori_int = int
|
||||||
|
|
|
@ -20,6 +20,8 @@ namespace jittor {
|
||||||
|
|
||||||
CublasMatmulOp::CublasMatmulOp(Var* a, Var* b, bool trans_a, bool trans_b)
|
CublasMatmulOp::CublasMatmulOp(Var* a, Var* b, bool trans_a, bool trans_b)
|
||||||
: a(a), b(b), trans_a(trans_a), trans_b(trans_b) {
|
: a(a), b(b), trans_a(trans_a), trans_b(trans_b) {
|
||||||
|
flags.set(NodeFlags::_cuda, 1);
|
||||||
|
flags.set(NodeFlags::_cpu, 0);
|
||||||
// TODO: support int8 * int8
|
// TODO: support int8 * int8
|
||||||
ASSERT(a->dtype().is_float() && b->dtype().is_float()) << "type of two inputs should be the same";
|
ASSERT(a->dtype().is_float() && b->dtype().is_float()) << "type of two inputs should be the same";
|
||||||
// TODO: support diffrent input type
|
// TODO: support diffrent input type
|
||||||
|
@ -51,7 +53,6 @@ void CublasMatmulOp::jit_prepare(JK& jk) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // JIT
|
#else // JIT
|
||||||
#ifdef JIT_cpu
|
|
||||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||||
void CublasMatmulOp::jit_run() {
|
void CublasMatmulOp::jit_run() {
|
||||||
cublasHandle_t& handle_ = cublas_handle;
|
cublasHandle_t& handle_ = cublas_handle;
|
||||||
|
@ -78,7 +79,6 @@ void CublasMatmulOp::jit_run() {
|
||||||
a->ptr<T>(), '@Trans_a' == 'N' ? m : n, &beta,
|
a->ptr<T>(), '@Trans_a' == 'N' ? m : n, &beta,
|
||||||
c->ptr<T>(), k));
|
c->ptr<T>(), k));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif // JIT
|
#endif // JIT
|
||||||
|
|
||||||
} // jittor
|
} // jittor
|
||||||
|
|
|
@ -19,11 +19,12 @@ struct cublas_initer {
|
||||||
inline cublas_initer() {
|
inline cublas_initer() {
|
||||||
if (!get_device_count()) return;
|
if (!get_device_count()) return;
|
||||||
checkCudaErrors(cublasCreate(&cublas_handle));
|
checkCudaErrors(cublasCreate(&cublas_handle));
|
||||||
LOGv << "cublasCreate finished";
|
LOGv << "cublasCreate finished" << (void*)cublas_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ~cublas_initer() {
|
inline ~cublas_initer() {
|
||||||
if (!get_device_count()) return;
|
if (!get_device_count()) return;
|
||||||
|
LOGv << "cublasDestroy:" << (void*)cublas_handle;
|
||||||
checkCudaErrors(cublasDestroy(cublas_handle));
|
checkCudaErrors(cublasDestroy(cublas_handle));
|
||||||
LOGv << "cublasDestroy finished";
|
LOGv << "cublasDestroy finished";
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,10 @@ int current_seed;
|
||||||
// fron fetch_op.cc
|
// fron fetch_op.cc
|
||||||
extern list<VarPtr> fetcher;
|
extern list<VarPtr> fetcher;
|
||||||
extern list<VarPtr> fetcher_to_free;
|
extern list<VarPtr> fetcher_to_free;
|
||||||
|
extern bool exited;
|
||||||
|
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
|
exited = true;
|
||||||
fetcher_to_free.clear();
|
fetcher_to_free.clear();
|
||||||
fetcher.clear();
|
fetcher.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,6 +235,7 @@ void segfault_sigaction(int signal, siginfo_t *si, void *arg) {
|
||||||
exited = true;
|
exited = true;
|
||||||
do_exit();
|
do_exit();
|
||||||
}
|
}
|
||||||
|
if (exited) do_exit();
|
||||||
std::cerr << "Caught segfault at address " << si->si_addr << ", "
|
std::cerr << "Caught segfault at address " << si->si_addr << ", "
|
||||||
<< "thread_name: '" << thread_name << "', flush log..." << std::endl;
|
<< "thread_name: '" << thread_name << "', flush log..." << std::endl;
|
||||||
std::cerr.flush();
|
std::cerr.flush();
|
||||||
|
|
Loading…
Reference in New Issue