add automatic load of libcudart.so at start of cling -xcuda
This commit is contained in:
parent
4f73d1b93d
commit
3b656d1d3f
@ -257,6 +257,14 @@ namespace cling {
|
||||
setupCallbacks(*this, parentInterp);
|
||||
}
|
||||
|
||||
if(m_Opts.CompilerOpts.CUDA){
|
||||
if(m_DyLibManager->loadLibrary("libcudart.so", true) ==
|
||||
cling::DynamicLibraryManager::LoadLibResult::kLoadLibNotFound){
|
||||
llvm::errs() << "Error: libcudart.so not found!\n" <<
|
||||
"Please add the cuda lib path to LD_LIBRARY_PATH or set it via -L argument.\n";
|
||||
}
|
||||
}
|
||||
|
||||
llvm::SmallVector<IncrementalParser::ParseResultTransaction, 2>
|
||||
IncrParserTransactions;
|
||||
if (!m_IncrParser->Initialize(IncrParserTransactions, parentInterp)) {
|
||||
|
24
test/Driver/CUDAMode.C
Normal file
24
test/Driver/CUDAMode.C
Normal file
@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// CLING - the C++ LLVM-based InterpreterG :)
|
||||
//
|
||||
// This file is dual-licensed: you can choose to license it under the University
|
||||
// of Illinois Open Source License or the GNU Lesser General Public License. See
|
||||
// LICENSE.TXT for details.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// The Test starts the cling with the arg -xcuda and checks if the cuda mode
|
||||
// is enabled.
|
||||
// RUN: cat %s | %cling -x cuda -Xclang -verify 2>&1 | FileCheck %s
|
||||
// RUN: cat %s | %cling -x cuda -fsyntax-only -Xclang -verify 2>&1
|
||||
// REQUIRES: cuda-runtime
|
||||
|
||||
|
||||
.rawInput 1
|
||||
__global__ void foo(){ int i = 3; }
|
||||
.rawInput 0
|
||||
|
||||
cudaError error
|
||||
// CHECK: (cudaError) (cudaError::cudaSuccess) : (unsigned int) 0
|
||||
|
||||
// expected-no-diagnostics
|
||||
.q
|
@ -314,6 +314,9 @@ if os.path.isdir(config.llvm_src_root + '/tools/clang') and \
|
||||
os.path.isdir(config.llvm_src_root + '/tools/cling'):
|
||||
config.available_features.add('vanilla-cling')
|
||||
|
||||
if lit.util.which('libcudart.so', config.environment.get('LD_LIBRARY_PATH','')) is not None:
|
||||
config.available_features.add('cuda-runtime')
|
||||
|
||||
# Loadable module
|
||||
# FIXME: This should be supplied by Makefile or autoconf.
|
||||
#if sys.platform in ['win32', 'cygwin']:
|
||||
|
Loading…
x
Reference in New Issue
Block a user