MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / load_program

Function load_program

deps/GraphBLAS/CUDA/jitify.hpp:2592–2732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2590}
2591
2592inline void load_program(std::string const& cuda_source,
2593 std::vector<std::string> const& headers,
2594 file_callback_type file_callback,
2595 std::vector<std::string>* include_paths,
2596 std::map<std::string, std::string>* program_sources,
2597 std::vector<std::string>* program_options,
2598 std::string* program_name) {
2599 // Extract include paths from compile options
2600 std::vector<std::string>::iterator iter = program_options->begin();
2601 while (iter != program_options->end()) {
2602 std::string const& opt = *iter;
2603 if (opt.substr(0, 2) == "-I") {
2604 include_paths->push_back(opt.substr(2));
2605 iter = program_options->erase(iter);
2606 } else {
2607 ++iter;
2608 }
2609 }
2610
2611 // Load program source
2612 if (!detail::load_source(cuda_source, *program_sources, "", *include_paths,
2613 file_callback)) {
2614 throw std::runtime_error("Source not found: " + cuda_source);
2615 }
2616 *program_name = program_sources->begin()->first;
2617
2618 // Maps header include names to their full file paths.
2619 std::map<std::string, std::string> header_fullpaths;
2620
2621 // Load header sources
2622 for (std::string const& header : headers) {
2623 if (!detail::load_source(header, *program_sources, "", *include_paths,
2624 file_callback, &header_fullpaths)) {
2625 // **TODO: Deal with source not found
2626 throw std::runtime_error("Source not found: " + header);
2627 }
2628 }
2629
2630#if JITIFY_PRINT_SOURCE
2631 std::string& program_source = (*program_sources)[*program_name];
2632 std::cout << "---------------------------------------" << std::endl;
2633 std::cout << "--- Source of " << *program_name << " ---" << std::endl;
2634 std::cout << "---------------------------------------" << std::endl;
2635 detail::print_with_line_numbers(program_source);
2636 std::cout << "---------------------------------------" << std::endl;
2637#endif
2638
2639 std::vector<std::string> compiler_options, linker_files, linker_paths;
2640 detail::split_compiler_and_linker_options(*program_options, &compiler_options,
2641 &linker_files, &linker_paths);
2642
2643 // If no arch is specified at this point we use whatever the current
2644 // context is. This ensures we pick up the correct internal headers
2645 // for arch-dependent compilation, e.g., some intrinsics are only
2646 // present for specific architectures.
2647 detail::detect_and_add_cuda_arch(compiler_options);
2648 detail::detect_and_add_cxx11_flag(compiler_options);
2649

Callers 2

load_sourcesMethod · 0.85
ProgramMethod · 0.85

Calls 13

load_sourceFunction · 0.85
print_with_line_numbersFunction · 0.85
detect_and_add_cuda_archFunction · 0.85
compile_kernelFunction · 0.85
print_compile_logFunction · 0.85
path_baseFunction · 0.85
comment_out_code_lineFunction · 0.85
beginMethod · 0.80

Tested by

no test coverage detected