| ceed-jit-tools.c (daaf13a462f999a7d367f3df68e0e3c34270722c) | ceed-jit-tools.c (b13efd58b277efef1db70d6f06eaaf4d415a7642) |
|---|---|
| 1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include <ceed-impl.h> --- 386 unchanged lines hidden (view full) --- 395 @param[in] relative_file_path Relative path to installed JiT file 396 @param[out] absolute_file_path String buffer for absolute path to target file, to be freed by caller 397 398 @return An error code: 0 - success, otherwise - failure 399 400 @ref Backend 401**/ 402int CeedGetJitAbsolutePath(Ceed ceed, const char *relative_file_path, const char **absolute_file_path) { | 1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include <ceed-impl.h> --- 386 unchanged lines hidden (view full) --- 395 @param[in] relative_file_path Relative path to installed JiT file 396 @param[out] absolute_file_path String buffer for absolute path to target file, to be freed by caller 397 398 @return An error code: 0 - success, otherwise - failure 399 400 @ref Backend 401**/ 402int CeedGetJitAbsolutePath(Ceed ceed, const char *relative_file_path, const char **absolute_file_path) { |
| 403 Ceed ceed_parent; | 403 const char **jit_source_dirs; 404 CeedInt num_source_dirs; |
| 404 405 // Debug 406 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- Ceed JiT ----------\n"); 407 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Relative JiT source file: "); 408 CeedDebug(ceed, "%s\n", relative_file_path); 409 | 405 406 // Debug 407 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- Ceed JiT ----------\n"); 408 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Relative JiT source file: "); 409 CeedDebug(ceed, "%s\n", relative_file_path); 410 |
| 410 CeedCall(CeedGetParent(ceed, &ceed_parent)); 411 for (CeedInt i = 0; i < ceed_parent->num_jit_source_roots; i++) { | 411 CeedCallBackend(CeedGetJitSourceRoots(ceed, &num_source_dirs, &jit_source_dirs)); 412 for (CeedInt i = 0; i < num_source_dirs; i++) { |
| 412 bool is_valid; 413 414 // Debug 415 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Checking JiT root: "); | 413 bool is_valid; 414 415 // Debug 416 CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Checking JiT root: "); |
| 416 CeedDebug(ceed, "%s\n", ceed_parent->jit_source_roots[i]); | 417 CeedDebug(ceed, "%s\n", jit_source_dirs[i]); |
| 417 418 // Build and check absolute path with current root | 418 419 // Build and check absolute path with current root |
| 419 CeedCall(CeedPathConcatenate(ceed, ceed_parent->jit_source_roots[i], relative_file_path, (char **)absolute_file_path)); | 420 CeedCall(CeedPathConcatenate(ceed, jit_source_dirs[i], relative_file_path, (char **)absolute_file_path)); |
| 420 CeedCall(CeedCheckFilePath(ceed, *absolute_file_path, &is_valid)); 421 | 421 CeedCall(CeedCheckFilePath(ceed, *absolute_file_path, &is_valid)); 422 |
| 422 if (is_valid) return CEED_ERROR_SUCCESS; | 423 if (is_valid) { 424 CeedCallBackend(CeedRestoreJitSourceRoots(ceed, &jit_source_dirs)); 425 return CEED_ERROR_SUCCESS; 426 } |
| 423 // LCOV_EXCL_START | 427 // LCOV_EXCL_START |
| 424 else CeedCall(CeedFree(absolute_file_path)); | 428 else 429 CeedCall(CeedFree(absolute_file_path)); |
| 425 // LCOV_EXCL_STOP 426 } 427 // LCOV_EXCL_START 428 return CeedError(ceed, CEED_ERROR_MAJOR, "Couldn't find matching JiT source file: %s", relative_file_path); 429 // LCOV_EXCL_STOP 430} | 430 // LCOV_EXCL_STOP 431 } 432 // LCOV_EXCL_START 433 return CeedError(ceed, CEED_ERROR_MAJOR, "Couldn't find matching JiT source file: %s", relative_file_path); 434 // LCOV_EXCL_STOP 435} |