diff --git a/README.md b/README.md index cac6ebc..f81a919 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,18 @@ Then simply run ``` pip install . ``` + +## Using non default Compilers + +Usually, Python uses the compiler provided by `cc`. For the initialisation of the subsystem, the compiler is determined by calling Score-P. However, there is no way I am aware of to force the compiler during installation, expect by specifying the `CC` environment variable. + +So if you are planning to use non-default Compiler like Intel, please install the bindings using: + +``` +CC=`scorep-config --cc` CXX=`scorep-config --cxx` pip install . +``` + + # Use To trace the full script you need to run diff --git a/scorep/helper.py b/scorep/helper.py index 2306abc..c5264b9 100644 --- a/scorep/helper.py +++ b/scorep/helper.py @@ -81,6 +81,8 @@ def generate_compile_deps(config=[]): (_, libs, _) = call(scorep_config + ["--libs"]) (_, mgmt_libs, _) = call(scorep_config + ["--mgmt-libs"]) (_, cflags, _) = call(scorep_config + ["--cflags"]) + (_, cc, _) = call(scorep_config + ["--cc"]) + (_, cxx, _) = call(scorep_config + ["--cxx"]) libs = " " + libs + " " + mgmt_libs ldflags = " " + ldflags @@ -104,4 +106,4 @@ def remove_space1(x): return x[1:] macro = list(map(lambda x: tuple([x, 1]), macro)) - return (include, lib, lib_dir, macro, linker_flags) + return (include, lib, lib_dir, macro, linker_flags, cc, cxx) diff --git a/scorep/subsystem.py b/scorep/subsystem.py index f93d6d9..6e15fda 100644 --- a/scorep/subsystem.py +++ b/scorep/subsystem.py @@ -48,7 +48,7 @@ def generate(scorep_config, keep_files=False): """ (include, lib, lib_dir, macro, - linker_flags_tmp) = scorep.helper.generate_compile_deps(scorep_config) + linker_flags_tmp, cc, cxx) = scorep.helper.generate_compile_deps(scorep_config) scorep_adapter_init = generate_subsystem_code(scorep_config) # add -Wl,-no-as-needed to tell the compiler that we really want to link these. Actually this sould be default. @@ -67,10 +67,13 @@ def generate(scorep_config, keep_files=False): subsystem_lib_name = gen_subsystem_lib_name() - cc = distutils.ccompiler.new_compiler() - compiled_subsystem = cc.compile( + compiler = distutils.ccompiler.new_compiler() + + # distutils UnixCCompiler as of python 3.7 simply doens not care about compiler, thats why we need to set compiler_so. + compiler.set_executables(compiler=cc, compiler_cxx=cxx, compiler_so=cc) + compiled_subsystem = compiler.compile( [temp_dir + "/scorep_init.c"], output_dir=temp_dir) - cc.link( + compiler.link( "scorep_init_mpi", objects=compiled_subsystem, output_filename=subsystem_lib_name, @@ -93,3 +96,4 @@ def clean_up(keep_files=True): else: if ("SCOREP_PYTHON_BINDINGS_TEMP_DIR" in os.environ) and (os.environ["SCOREP_PYTHON_BINDINGS_TEMP_DIR"] != ""): shutil.rmtree(os.environ["SCOREP_PYTHON_BINDINGS_TEMP_DIR"]) + diff --git a/setup.py b/setup.py index c682008..86888a4 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup, Extension import scorep.helper -(include, lib, lib_dir, macro, linker_flags) = scorep.helper.generate_compile_deps() +(include, lib, lib_dir, macro, linker_flags, cc, cxx) = scorep.helper.generate_compile_deps() cmodules = [] @@ -14,7 +14,7 @@ setup( name='scorep', - version='1.0', + version='1.2', description='This is a scorep tracing package for python', author='Andreas Gocht', author_email='andreas.gocht@tu-dresden.de',