77import scorep .helper
88
99
10- def gen_subsystem_lib_name ():
10+ def generate_subsystem_lib_name ():
1111 """
1212 generate the name for the subsystem lib.
1313 """
@@ -16,6 +16,19 @@ def gen_subsystem_lib_name():
1616 return mpi_lib_name
1717
1818
19+ def generate_ld_preload (scorep_config ):
20+ """
21+ This functions generate a string that needs to be passed to $LD_PRELOAD.
22+ After this sting is passed, the tracing needs to be restarted with this $LD_PRELOAD in env.
23+
24+ @return ld_preload string which needs to be passed to LD_PRELOAD
25+ """
26+
27+ (_ , preload , _ ) = scorep .helper .call (
28+ ["scorep-config" ] + scorep_config + ["--user" , "--preload-libs" ])
29+ return preload
30+
31+
1932def generate_subsystem_code (config = []):
2033 """
2134 Generates the data needed to be preloaded.
@@ -45,6 +58,13 @@ def generate(scorep_config, keep_files=False):
4558 (include , lib , lib_dir , macro ,
4659 linker_flags_tmp ) = scorep .helper .generate_compile_deps (scorep_config )
4760 scorep_adapter_init = generate_subsystem_code (scorep_config )
61+ if ("-lscorep_adapter_opari2_mgmt" in lib ):
62+ scorep_adapter_init += "\n "
63+ scorep_adapter_init += "/* OPARI dependencies */\n "
64+ scorep_adapter_init += "void POMP2_Init_regions(){}\n "
65+ scorep_adapter_init += "size_t POMP2_Get_num_regions(){return 0;};\n "
66+ scorep_adapter_init += "void POMP2_USER_Init_regions(){};\n "
67+ scorep_adapter_init += "size_t POMP2_USER_Get_num_regions(){return 0;};\n "
4868
4969 # add -Wl,-no-as-needed to tell the compiler that we really want to link these. Actually this sould be default.
5070 # as distutils adds extra args at the very end we need to add all the libs
@@ -62,7 +82,7 @@ def generate(scorep_config, keep_files=False):
6282 with open (temp_dir + "/scorep_init.c" , "w" ) as f :
6383 f .write (scorep_adapter_init )
6484
65- subsystem_lib_name = gen_subsystem_lib_name ()
85+ subsystem_lib_name = generate_subsystem_lib_name ()
6686
6787 cc = distutils .ccompiler .new_compiler ()
6888 compiled_subsystem = cc .compile (
@@ -97,7 +117,7 @@ def init_environment(scorep_config=[], keep_files=False):
97117
98118 subsystem_lib_name , temp_dir = scorep .subsystem .generate (
99119 scorep_config , keep_files )
100- scorep_ld_preload = scorep . helper . generate_ld_preload (scorep_config )
120+ scorep_ld_preload = generate_ld_preload (scorep_config )
101121
102122 scorep .helper .add_to_ld_library_path (temp_dir )
103123
0 commit comments