@@ -230,6 +230,8 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
230230 if (dir) {
231231 closedir (dir);
232232 } else {
233+ // In parallel multiple processes may attempt
234+ // Only one process needs to succeed
233235 mkdir (" temp" , 0777 );
234236 chmod (" temp" , 0777 );
235237 }
@@ -284,6 +286,7 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
284286 std::to_string (build_id) + " _1_wrapped.ll " ;
285287 command += opts[4 ];
286288 CeedCallSystem (ceed, command.c_str (), " JiT kernel source" );
289+ CeedCallSystem (ceed, (" chmod 0777 temp/kernel_" + std::to_string (build_id) + " _1_wrapped.ll" ).c_str (), " update JiT file permissions" );
287290
288291 // the find command finds the rust-installed llvm-link tool and runs it
289292 command = " $(find $(rustup run " + std::string (rust_toolchain) + " rustc --print sysroot) -name llvm-link) temp/kernel_" +
@@ -322,12 +325,14 @@ static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_
322325 std::to_string (build_id) + " _2_linked.ll -o temp/kernel_" + std::to_string (build_id) + " _3_opt.bc" )
323326 .c_str (),
324327 " optimize linked C and Rust source" );
328+ CeedCallSystem (ceed, (" chmod 0777 temp/kernel_" + std::to_string (build_id) + " _2_linked.ll" ).c_str (), " update JiT file permissions" );
325329 CeedCallSystem (ceed,
326330 (" $(find $(rustup run " + std::string (rust_toolchain) + " rustc --print sysroot) -name llc) -O3 -mcpu=sm_" +
327331 std::to_string (prop.major ) + std::to_string (prop.minor ) + " temp/kernel_" + std::to_string (build_id) +
328332 " _3_opt.bc -o temp/kernel_" + std::to_string (build_id) + " _4_final.ptx" )
329333 .c_str (),
330334 " compile final CUDA kernel" );
335+ CeedCallSystem (ceed, (" chmod 0777 temp/kernel_" + std::to_string (build_id) + " _4_final.ptx" ).c_str (), " update JiT file permissions" );
331336
332337 ifstream ptxfile (" temp/kernel_" + std::to_string (build_id) + " _4_final.ptx" );
333338 ostringstream sstr;
0 commit comments