line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::OpenMP; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
809
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
5
|
use Config (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
445
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.003002'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# set as package variable since %Config::Config is read only, (per docs and in practice) |
10
|
|
|
|
|
|
|
our $CCNAME = $Config::Config{ccname}; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# per-compiler meta data, each supported compiler will require an entry |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $omp_flags = { |
15
|
|
|
|
|
|
|
# used by ccflags, lddlflags |
16
|
|
|
|
|
|
|
gcc => '-fopenmp', |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $omp_check_libs = { |
20
|
|
|
|
|
|
|
# used by _check_libs, intended for use by Devel::CheckLib |
21
|
|
|
|
|
|
|
gcc => [qw/gomp/], |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $omp_check_headers = { |
25
|
|
|
|
|
|
|
# used by _check_headers, intended for use by Devel::CheckLib |
26
|
|
|
|
|
|
|
gcc => [qw/omp.h/], |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# "public" Alien::Base method implementations |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub cflags { |
32
|
3
|
|
|
3
|
1
|
1517
|
my $cn = $CCNAME; |
33
|
3
|
|
|
|
|
8
|
_assert_os($omp_flags, $cn); |
34
|
2
|
|
|
|
|
10
|
return $omp_flags->{$cn}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# we can reuse cflags for gcc/gomp; hopefully this will |
38
|
|
|
|
|
|
|
# remain the case for all supported compilers |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub lddlflags { |
41
|
3
|
|
|
3
|
1
|
551
|
my $cn = $CCNAME; |
42
|
3
|
|
|
|
|
7
|
_assert_os($omp_flags, $cn); |
43
|
2
|
|
|
|
|
8
|
return $omp_flags->{$cn}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Inline related methods |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub Inline { |
49
|
0
|
|
|
0
|
1
|
0
|
my ($self, $lang) = @_; |
50
|
|
|
|
|
|
|
return { |
51
|
|
|
|
|
|
|
CCFLAGS => cflags(), |
52
|
0
|
|
|
|
|
0
|
LDDLFLAGS => join( q{ }, $Config::Config{lddlflags}, lddlflags() ), |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# "private" internal helper subs |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _assert_os { |
59
|
10
|
|
|
10
|
|
20
|
my ($omp, $cn) = @_; |
60
|
|
|
|
|
|
|
# OpenMP pragmas live behind source code comments |
61
|
10
|
100
|
|
|
|
26
|
if ( not defined $omp->{$cn} ) { |
62
|
|
|
|
|
|
|
# dies the same way as ExtUtils::MakeMaker::os_unsupported() |
63
|
4
|
|
|
|
|
23
|
die qq{OS unsupported\n}; |
64
|
|
|
|
|
|
|
} |
65
|
6
|
|
|
|
|
10
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _check_libs { |
69
|
2
|
|
|
2
|
|
521
|
my $cn = $CCNAME; |
70
|
2
|
|
|
|
|
6
|
_assert_os($omp_check_libs, $cn); |
71
|
1
|
|
|
|
|
6
|
return $omp_check_libs->{$cn}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _check_headers { |
75
|
2
|
|
|
2
|
|
517
|
my $cn = $CCNAME; |
76
|
2
|
|
|
|
|
6
|
_assert_os($omp_check_headers, $cn); |
77
|
1
|
|
|
|
|
5
|
return $omp_check_headers->{$cn}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |