@@ -227,7 +227,6 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
227227 CeedCallBackend (CeedRestoreRustSourceRoots (ceed, &rust_source_dirs));
228228
229229 // Compile with rust
230-
231230 int err;
232231 std::string cmd;
233232
@@ -251,8 +250,8 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
251250 // Note: this is necessary because rust crate names may not match the folder they are in
252251 for (CeedInt i = 0 ; i < num_rust_source_dirs; i++) {
253252 std::string dir = rust_dirs[i] + " /target/nvptx64-nvidia-cuda/release" ;
254-
255253 DIR *dp = opendir (dir.c_str ());
254+
256255 CeedCheck (dp != nullptr , ceed, CEED_ERROR_BACKEND, " Could not open directory: %s" , dir.c_str ());
257256 struct dirent *entry;
258257
@@ -268,9 +267,8 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
268267 // Todo: when libceed switches to c++17, switch to std::filesystem for the loop above
269268 }
270269
270+ CeedDebug (ceed, " Running llvm-link: %s\n " , cmd.c_str ());
271271 err = system (cmd.c_str ());
272-
273- CeedDebug (ceed, " llvm-link command was %s\n " , cmd.c_str ());
274272 CeedCheck (!err, ceed, CEED_ERROR_BACKEND, " Failed to link C and Rust sources with LLVM\n llvm-link command: %s" , cmd.c_str ());
275273
276274 err = system (" opt --passes internalize,inline kern2.ll -o kern3.bc" );
@@ -280,11 +278,11 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
280278 CeedCheck (!err, ceed, CEED_ERROR_BACKEND, " Failed to compile QFunction LLVM IR)\n " );
281279
282280 ifstream ptxfile (" kern.ptx" );
283-
284281 ostringstream sstr;
282+
285283 sstr << ptxfile.rdbuf ();
284+
286285 auto ptx_data = sstr.str ();
287-
288286 ptx_size = ptx_data.length ();
289287
290288 CeedCallCuda (ceed, cuModuleLoadData (module , ptx_data.c_str ()));
0 commit comments