aboutsummaryrefslogtreecommitdiff
path: root/runtime/tools
diff options
context:
space:
mode:
authorJim Cownie <james.h.cownie@intel.com>2013-12-23 17:28:57 +0000
committerJim Cownie <james.h.cownie@intel.com>2013-12-23 17:28:57 +0000
commit024c10806dc0b61950f0d094da1658d09f3e1b38 (patch)
treef8f789bf3665dfbf9ffaa40fd1fc013779a318a7 /runtime/tools
parentf1de1826bddd32ce5aecaff3755fa9f940c6412a (diff)
For your Christmas hacking pleasure.
This release use aligns with Intel(r) Composer XE 2013 SP1 Product Update 2 New features * The library can now be built with clang (though wiht some limitations since clang does not support 128 bit floats) * Support for Vtune analysis of load imbalance * Code contribution from Steven Noonan to build the runtime for ARM* architecture processors * First implementation of runtime API for OpenMP cancellation Bug Fixes * Fixed hang on Windows (only) when using KMP_BLOCKTIME=0 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@197914 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime/tools')
-rwxr-xr-xruntime/tools/check-tools.pl77
-rw-r--r--runtime/tools/common.inc10
-rw-r--r--runtime/tools/lib/Platform.pm10
-rw-r--r--runtime/tools/lib/Uname.pm4
-rw-r--r--runtime/tools/src/common-checks.mk28
-rw-r--r--runtime/tools/src/common-defs.mk6
-rw-r--r--runtime/tools/src/common-tools.mk32
7 files changed, 136 insertions, 31 deletions
diff --git a/runtime/tools/check-tools.pl b/runtime/tools/check-tools.pl
index 8140e11..1878ca5 100755
--- a/runtime/tools/check-tools.pl
+++ b/runtime/tools/check-tools.pl
@@ -268,6 +268,9 @@ sub get_gnu_compiler_version($) {
} elsif ( $stdout =~ m{^.*? \(SUSE Linux\) (\d+\.\d+\.\d+)\s+\[.*? (\d+)\]}m ) {
# gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]
( $ver, $bld ) = ( $1, $2 );
+ } elsif ( $stdout =~ m{^.*? \(SUSE Linux\) (\d+\.\d+\.\d+)\s+\d+\s+\[.*? (\d+)\]}m ) {
+ # gcc (SUSE Linux) 4.7.2 20130108 [gcc-4_7-branch revision 195012]
+ ( $ver, $bld ) = ( $1, $2 );
} elsif ( $stdout =~ m{^.*? \((Debian|Ubuntu).*?\) (\d+\.\d+\.\d+)}m ) {
# gcc (Debian 4.7.2-22) 4.7.2
# Debian support from Sylvestre Ledru
@@ -286,6 +289,35 @@ sub get_gnu_compiler_version($) {
}; # sub get_gnu_compiler_version
+sub get_clang_compiler_version($) {
+ my ( $tool ) = @_;
+ my ( @ret ) = ( $tool );
+ my ( $rc, $stdout, $stderr, $version );
+ $rc = run( [ $tool, "--version" ], $stdout, $stderr );
+ if ( $rc >= 0 ) {
+ my ( $ver, $bld );
+ if ( $target_os eq "mac" ) {
+ # Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
+ $stdout =~ m{^.*? (\d+\.\d+) \(.*-(\d+\.\d+\.\d+)\)}m;
+ ( $ver, $bld ) = ( $1, $2 );
+ } else {
+ if ( 0 ) {
+ } elsif ( $stdout =~ m{^.*? (\d+\.\d+) \((.*)\)}m ) {
+ # clang version 3.3 (tags/RELEASE_33/final)
+ ( $ver, $bld ) = ( $1, $2 );
+ }
+ }; # if
+ if ( defined( $ver ) ) {
+ $version = $ver . ( defined( $bld ) ? " ($bld)" : "" );
+ } else {
+ warning( "Cannot parse Clang compiler version:", $stdout, "(eof)" );
+ }; # if
+ }; # if
+ push( @ret, $version );
+ return @ret;
+}; # sub get_gnu_compiler_version
+
+
sub get_ms_compiler_version() {
my ( $rc, $stdout, $stderr, $version );
my $tool = "cl";
@@ -349,18 +381,30 @@ sub get_ms_linker_version() {
my $make;
my $intel = 1; # Check Intel compilers.
-my $gnu_fortran = 0; # Check GNU Fortran.
+my $fortran = 0; # Check for corresponding Fortran compiler, ifort for intel
+ # gfortran for gnu
+ # gfortran for clang
+my $clang = 0; # Check Clang Compilers.
my $intel_compilers = {
"lin" => { c => "icc", cpp => "icpc", f => "ifort" },
"lrb" => { c => "icc", cpp => "icpc", f => "ifort" },
"mac" => { c => "icc", cpp => "icpc", f => "ifort" },
"win" => { c => "icl", cpp => undef, f => "ifort" },
};
+my $gnu_compilers = {
+ "lin" => { c => "gcc", cpp => "g++", f => "gfortran" },
+ "mac" => { c => "gcc", cpp => "g++", f => "gfortran" },
+};
+my $clang_compilers = {
+ "lin" => { c => "clang", cpp => "clang++" },
+ "mac" => { c => "clang", cpp => "clang++" },
+};
get_options(
Platform::target_options(),
"intel!" => \$intel,
- "gnu-fortran!" => \$gnu_fortran,
+ "fortran" => \$fortran,
+ "clang" => \$clang,
"make" => \$make,
"pedantic" => \$pedantic,
);
@@ -375,21 +419,32 @@ if ( $intel ) {
# If Intel C++ compiler has a name different from C compiler, check it as well.
push( @versions, [ "Intel C++ Compiler", get_intel_compiler_version( $ic->{ cpp } ) ] );
}; # if
- if ( defined( $ic->{ f } ) ) {
- push( @versions, [ "Intel Fortran Compiler", get_intel_compiler_version( $ic->{ f } ) ] );
- }; # if
+ # fortran check must be explicitly specified on command line with --fortran
+ if ( $fortran ) {
+ if ( defined( $ic->{ f } ) ) {
+ push( @versions, [ "Intel Fortran Compiler", get_intel_compiler_version( $ic->{ f } ) ] );
+ }; # if
+ };
}; # if
if ( $target_os eq "lin" or $target_os eq "mac" ) {
- push( @versions, [ "GNU C Compiler", get_gnu_compiler_version( "gcc" ) ] );
- push( @versions, [ "GNU C++ Compiler", get_gnu_compiler_version( "g++" ) ] );
- if ( $gnu_fortran ) {
- push( @versions, [ "GNU Fortran Compiler", get_gnu_compiler_version( "gfortran" ) ] );
- }; # if
-}; # if
+ # check for gnu tools by default because touch-test.c is compiled with them.
+ push( @versions, [ "GNU C Compiler", get_gnu_compiler_version( $gnu_compilers->{ $target_os }->{ c } ) ] );
+ push( @versions, [ "GNU C++ Compiler", get_gnu_compiler_version( $gnu_compilers->{ $target_os }->{ cpp } ) ] );
+ if ( $clang ) {
+ push( @versions, [ "Clang C Compiler", get_clang_compiler_version( $clang_compilers->{ $target_os }->{ c } ) ] );
+ push( @versions, [ "Clang C++ Compiler", get_clang_compiler_version( $clang_compilers->{ $target_os }->{ cpp } ) ] );
+ };
+ # if intel fortran has been checked then gnu fortran is unnecessary
+ # also, if user specifies clang as build compiler, then gfortran is assumed fortran compiler
+ if ( $fortran and not $intel ) {
+ push( @versions, [ "GNU Fortran Compiler", get_gnu_compiler_version( $gnu_compilers->{ $target_os }->{ f } ) ] );
+ };
+};
if ( $target_os eq "win" ) {
push( @versions, [ "MS C/C++ Compiler", get_ms_compiler_version() ] );
push( @versions, [ "MS Linker", get_ms_linker_version() ] );
}; # if
+
my $count = 0;
foreach my $item ( @versions ) {
my ( $title, $tool, $version ) = @$item;
diff --git a/runtime/tools/common.inc b/runtime/tools/common.inc
index 4154b29..8eceb98 100644
--- a/runtime/tools/common.inc
+++ b/runtime/tools/common.inc
@@ -56,10 +56,14 @@ endif
# Setting defaults
mode?=release
-ifeq "$(omp_os)" "windows"
- compiler?=icl
+ifeq "$(filter 32 32e 64,$(arch))" ""
+ compiler?=gcc
else
- compiler?=icc
+ ifeq "$(omp_os)" "windows"
+ compiler?=icl
+ else
+ compiler?=icc
+ endif
endif
ifneq "$(mic)" "no"
diff --git a/runtime/tools/lib/Platform.pm b/runtime/tools/lib/Platform.pm
index 584eeb7..d723174 100644
--- a/runtime/tools/lib/Platform.pm
+++ b/runtime/tools/lib/Platform.pm
@@ -48,6 +48,8 @@ sub canon_arch($) {
$arch = "32";
} elsif ( $arch =~ m{\A\s*(?:48|(?:ia)?32e|Intel\s*64|Intel\(R\)\s*64|x86[_-]64|x64|AMD64)\s*\z}i ) {
$arch = "32e";
+ } elsif ( $arch =~ m{\Aarm(?:v7\D*)?\z} ) {
+ $arch = "arm";
} else {
$arch = undef;
}; # if
@@ -59,6 +61,7 @@ sub canon_arch($) {
my %legal = (
"32" => "IA-32 architecture",
"32e" => "Intel(R) 64",
+ "arm" => "ARM",
);
sub legal_arch($) {
@@ -76,6 +79,7 @@ sub canon_arch($) {
"32" => "ia32",
"32e" => "intel64",
"64" => "ia64",
+ "arm" => "arm",
);
sub arch_opt($) {
@@ -153,6 +157,8 @@ sub target_options() {
$_host_arch = "64";
} elsif ( $hardware_platform eq "x86_64" ) {
$_host_arch = "32e";
+ } elsif ( $hardware_platform eq "arm" ) {
+ $_host_arch = "arm";
} else {
die "Unsupported host hardware platform: \"$hardware_platform\"; stopped";
}; # if
@@ -178,7 +184,7 @@ if ( defined( $ENV{ LIBOMP_ARCH } ) ) {
# Use arch specified in LIBOMP_ARCH.
$_target_arch = canon_arch( $ENV{ LIBOMP_ARCH } );
if ( not defined( $_target_arch ) ) {
- die "Uknown architecture specified in LIBOMP_ARCH environment variable: \"$ENV{ LIBOMP_ARCH }\"";
+ die "Unknown architecture specified in LIBOMP_ARCH environment variable: \"$ENV{ LIBOMP_ARCH }\"";
}; # if
} else {
# Otherwise use host architecture.
@@ -191,7 +197,7 @@ if ( defined( $ENV{ LIBOMP_OS } ) ) {
# Use OS specified in LIBOMP_OS.
$_target_os = canon_os( $ENV{ LIBOMP_OS } );
if ( not defined( $_target_os ) ) {
- die "Uknown OS specified in LIBOMP_OS environment variable: \"$ENV{ LIBOMP_OS }\"";
+ die "Unknown OS specified in LIBOMP_OS environment variable: \"$ENV{ LIBOMP_OS }\"";
}; # if
} else {
# Otherwise use host OS.
diff --git a/runtime/tools/lib/Uname.pm b/runtime/tools/lib/Uname.pm
index f978f8b..9556884 100644
--- a/runtime/tools/lib/Uname.pm
+++ b/runtime/tools/lib/Uname.pm
@@ -145,6 +145,8 @@ if ( 0 ) {
$values{ hardware_platform } = "i386";
} elsif ( $values{ machine } =~ m{\Ax86_64\z} ) {
$values{ hardware_platform } = "x86_64";
+ } elsif ( $values{ machine } =~ m{\Aarmv7\D*\z} ) {
+ $values{ hardware_platform } = "arm";
} else {
die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped";
}; # if
@@ -276,7 +278,7 @@ if ( 0 ) {
or runtime_error( "$release: Cannot find the first line:", $bulk, "(eof)" );
my $first_line = $1;
$values{ operating_system_description } = $first_line;
- $first_line =~ m{\A(.*?)\s+release\s+(.*?)\s+\((.*?)(?:\s+Update\s+(.*?))?\)\s*$}
+ $first_line =~ m{\A(.*?)\s+release\s+(.*?)(?:\s+\((.*?)(?:\s+Update\s+(.*?))?\))?\s*$}
or runtime_error( "$release:1: Cannot parse line:", $first_line );
$values{ operating_system_name } = $1;
$values{ operating_system_release } = $2 . ( defined( $4 ) ? ".$4" : "" );
diff --git a/runtime/tools/src/common-checks.mk b/runtime/tools/src/common-checks.mk
index 08c246f..0959fc6 100644
--- a/runtime/tools/src/common-checks.mk
+++ b/runtime/tools/src/common-checks.mk
@@ -19,17 +19,27 @@
# Check tools versions.
#
ifeq "$(clean)" "" # Do not check tools if clean goal specified.
- ifeq "$(c)" "gcc"
- curr_tools := $(strip $(shell $(perl) $(tools_dir)check-tools.pl $(oa-opts) --no-intel --gnu-fortran --make))
- ifneq "$(findstring N/A,$(curr_tools))" ""
- curr_tools := $(strip $(shell $(perl) $(tools_dir)check-tools.pl $(oa-opts) --make))
- fort = ifort
- else
- fort = gfortran
- endif
+
+ check_tools_flags = --make
+
+ # determine if fortran check is required from goals
+ # MAKECMDGOALS is like argv for gnu make
+ ifneq "$(filter mod all,$(MAKECMDGOALS))" ""
+ check_tools_flags += --fortran
else
- curr_tools := $(strip $(shell $(perl) $(tools_dir)check-tools.pl $(oa-opts) --make))
+ ifeq "$(MAKECMDGOALS)" "" # will default to all if no goals specified on command line
+ check_tools_flags += --fortran
+ endif
endif
+ ifneq "$(filter gcc clang,$(c))" "" # if build compiler is gcc or clang
+ check_tools_flags += --no-intel
+ endif
+ ifeq "$(c)" "clang"
+ check_tools_flags += --clang
+ endif
+
+ curr_tools := $(strip $(shell $(perl) $(tools_dir)check-tools.pl $(oa-opts) $(check_tools_flags)))
+
ifeq "$(curr_tools)" ""
$(error check-tools.pl failed)
endif
diff --git a/runtime/tools/src/common-defs.mk b/runtime/tools/src/common-defs.mk
index 1c164bc..ebd1922 100644
--- a/runtime/tools/src/common-defs.mk
+++ b/runtime/tools/src/common-defs.mk
@@ -45,7 +45,7 @@ endif
# Description:
# The function return printable name of specified architecture, IA-32 architecture or Intel(R) 64.
#
-legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(error Bad architecture specified: $(1))))))
+legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(error Bad architecture specified: $(1))))))
# Synopsis:
# var_name = $(call check_variable,var,list)
@@ -128,9 +128,9 @@ endif
# --------------------------------------------------------------------------------------------------
os := $(call check_variable,os,lin lrb mac win)
-arch := $(call check_variable,arch,32 32e 64)
+arch := $(call check_variable,arch,32 32e 64 arm)
platform := $(os)_$(arch)
-platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lrb_32e mac_32 mac_32e win_32 win_32e win_64)
+platform := $(call check_variable,platform,lin_32 lin_32e lin_64 lin_arm lrb_32e mac_32 mac_32e win_32 win_32e win_64)
# oa-opts means "os and arch options". They are passed to almost all perl scripts.
oa-opts := --os=$(os) --arch=$(arch)
diff --git a/runtime/tools/src/common-tools.mk b/runtime/tools/src/common-tools.mk
index 65bc92e..a9c9fbc 100644
--- a/runtime/tools/src/common-tools.mk
+++ b/runtime/tools/src/common-tools.mk
@@ -33,6 +33,10 @@
# on Windows* OS generates such a dependency: "kmp_runtime.obj: .\kmp_i18n.inc", and make complains
# "No rule to build .\kmp_i18n.inc". Using "./" solves the problem.
cpp-flags += -I ./
+# For non-x86 architecture
+ifeq "$(filter 32 32e 64,$(arch))" ""
+ cpp-flags += $(shell pkg-config --cflags libffi)
+endif
# Add all VPATH directories to path for searching include files.
cpp-flags += $(foreach i,$(VPATH),-I $(i))
@@ -60,6 +64,9 @@ ifneq "$(filter lin lrb mac,$(os))" ""
ifeq "$(c)" "gcc"
cxx = g++
endif
+ ifeq "$(c)" "clang"
+ cxx = clang++
+ endif
# Output file flag.
c-out = -o$(space)
cxx-out = -o$(space)
@@ -70,7 +77,9 @@ ifneq "$(filter lin lrb mac,$(os))" ""
c-flags-m += -M -MG
cxx-flags-m += -M -MG
# Enable C99 language.
- c-flags += -std=c99
+ ifneq "$(CPLUSPLUS)" "on"
+ c-flags += -std=gnu99
+ endif
# Generate position-independent code (a must for shared objects).
ifeq "$(LINK_TYPE)" "dyna"
c-flags += -fPIC
@@ -118,12 +127,24 @@ ifneq "$(filter lin lrb mac,$(os))" ""
ifeq "$(c)" "gcc"
as = gcc
endif
+ ifeq "$(c)" "clang"
+ as = clang
+ endif
as-out = -o$(space)
as-flags += $(cpp-flags)
# Compile only, no link.
as-flags += -c
as-flags += -x assembler-with-cpp
# --- Fortran ---
+ ifeq "$(c)" "icc"
+ fort = ifort
+ endif
+ ifeq "$(c)" "gcc"
+ fort = gfortran
+ endif
+ ifeq "$(c)" "clang"
+ fort = gfortran
+ endif
ifeq "$(fort)" ""
fort = ifort
endif
@@ -148,6 +169,11 @@ ifeq "$(os)" "lin"
cxx-flags += -mia32
endif
endif
+ ifeq "$(c)" "gcc"
+ ifeq "$(arch)" "arm"
+ c-flags += -marm
+ endif
+ endif
# --- Librarian ---
ar = ar
ar-out = $(empty)
@@ -298,7 +324,9 @@ ifeq "$(os)" "win"
c-flags-m += -QM -QMM -QMG
cxx-flags-m += -QM -QMM -QMG
# Enable C99 language.
- c-flags += -Qstd=c99
+ ifneq "$(CPLUSPLUS)" "on"
+ c-flags += -Qstd=gnu99
+ endif
# Enable C++ exception handling.
# ??? Why we disable it on Linux* OS?
cxx-flags += -EHsc