Alien-OpenMP

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

SYNOPSIS
        use Alien::OpenMP;
        say Alien::OpenMP->cflags;       # e.g. '-fopenmp' if gcc
        say Alien::OpenMP->lddlflags;    # e.g. '-fopenmp' if gcc
        say Alien::OpenMP->auto_include; # e.g. '#include <omp.h>' if gcc

DESCRIPTION
    This module encapsulates the knowledge required to compile OpenMP
    programs $Config{ccname}. "C", "Fortran", and "C++" programs annotated
    with declarative OpenMP pragmas will still compile if the compiler (and
    linker if this is a separate process) is not passed the appropriate flag
    to enable OpenMP support. This is because all pragmas are hidden behind
    full line comments (with the addition of OpenMP specific "sentinels", as
    they are called).

    All compilers require OpenMP to be explicitly activated during
    compilation; for example, GCC's implementation, "GOMP", is invoked by
    the "-fopenmp" flag.

    Most major compilers support OpenMP, including: GCC, Intel, IBM,
    Portland Group, NAG, and those compilers created using LLVM. GCC's

lib/Alien/OpenMP.pm  view on Meta::CPAN

    use Alien::OpenMP;
    say Alien::OpenMP->cflags;       # e.g. '-fopenmp' if gcc
    say Alien::OpenMP->lddlflags;    # e.g. '-fopenmp' if gcc
    say Alien::OpenMP->auto_include; # e.g. '#include <omp.h>' if gcc

=head1 DESCRIPTION

This module encapsulates the knowledge required to compile OpenMP programs
C<$Config{ccname}>. C<C>, C<Fortran>, and C<C++> programs annotated
with declarative OpenMP pragmas will still compile if the compiler (and
linker if this is a separate process) is not passed the appropriate flag
to enable OpenMP support. This is because all pragmas are hidden behind
full line comments (with the addition of OpenMP specific C<sentinels>,
as they are called).

All compilers require OpenMP to be explicitly activated during compilation;
for example, GCC's implementation, C<GOMP>, is invoked by the C<-fopenmp>
flag.

Most major compilers support OpenMP, including: GCC, Intel, IBM,
Portland Group, NAG, and those compilers created using LLVM. GCC's OpenMP

lib/Alien/OpenMP/configure.pm  view on Meta::CPAN


my $checked   = 0;
my $supported = {
    gcc => {
        cflags        => ['-fopenmp'],
        libs          => ['-fopenmp'],
        auto_include  => join qq{\n}, ('#include <omp.h>'),
    },
    clang => {
        cflags        => [ '-Xclang', '-fopenmp' ],
        libs          => ['-lomp'],                 # this could be -Xpreprocessor
        auto_include  => join qq{\n}, ('#include <omp.h>'),
    },
};

sub auto_include {
  shift->_update_supported;
  return $supported->{$CCNAME}{auto_include} || q{};
}

sub cflags {



( run in 0.356 second using v1.01-cache-2.11-cpan-8d75d55dd25 )