I have a new MacBook pro with the Apple M1 Max processor (10 cores total), running OS 12.2.1. I used Homebrew to install gcc:
~/homebrew/bin/gcc-11 --version
gcc-11 (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This package came with gfortran:
gfortran --version
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
It also came with mpifort:
mpifort --version
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I have a Fortran code that uses MPI along with OpenMP. It works well and has been used on various Linux boxes and on a supercomputer. I was doing some benchmarking of the new laptop and I noticed that the overall speed of my code depends on the the combination of the number of MPI tasks (np) and OpenMP threads:
np OMP_NUM_THREADS wall time loop time
(sec) (sec)
--------------------------------------------------
1 8 2731 299.906
2 4 1816 194.753
4 2 1424 156.876
8 1 1415 156.372
In all cases, a total of 8 cores were used. This particular test had a large loop, executed 9 times. The code using pure OpenMP is almost a factor of 2 slower than the code using pure MPI. I have done the same test on a linux box (AMD Ryzen threadripper) and there was essentially no change in execution times for various combinations of np and OMP_NUM_threads, where the product np*OMP_NUM_THREADS is constant.
My compile command is
gfortran -Ofast -fopenmp -march=native -mtune=native -fmax-stack-var-size=16384
for OpenMP only, and
mpifort -Ofast -fopenmp -march=native -mtune=native -fmax-stack-var-size=16384
for the MPI hybrid code. Are there compiler flags for the OpenMP version I could use to speed things up? I have a lot of related OpenMP codes that have not yet been modified to work with MPI, so it would be nice if some compiler tweaks could help.
On the other hand, is this a case of gfortran+OpenMP for Apple M1 needing more work at a deeper level than what I can do?
Related
When using Cloud 9 (now owned by Amazon and run as part of their AWS service) as an onlinet IDE for C and C++, and other compiled languages, it seems to create a virtual machine that uses version 4.8.5 of GCC. How do I use a more modern version of GCC, in order to utilize the C11 standard (and C18 revisions) and C++11 (and C++17 revisions) and to better utilize the more comprehensible and more friendly compiler error messages of more recent GCC, and Clang, versions.
How do I "request" or install a more modern version of GCC or possibly use a recent version of Clang as the compiler from within the Cloud 9 AWS instance/virtual machine?
The following command got my Cloud 9 IDE up to gcc version 7.2.1
sudo yum -y groupinstall "Development Tools"
gcc --version
gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I am currently in a CS class where we use C++, and I run Linux on my laptop. So the problem is that I think I don't have the most up to date version of C++. I've read online for several commands to get the version and this is my result. Also my Linux version is 16.04, and I am compiling in my terminal
tom#TBT-XPS-13-9360:~/Documents/Subjects/CS/OOP$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
I don' know what part of this is my actual version of C++. If my version is not the most up to date, can someone please give me DETAILED instructions on how to do it. Still getting my Linux legs.
C++ version (Or usually called c++ standard) is different than compiler version.
g++ is your compiler, and your current version is g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
You can use different command to compile your program using different C++ version.
g++ -std=c++11 yourFile .....
g++ -std=c++14 yourFile .....
As mentioned in the comments, this version of compiler may not support c++17 features yet
Use this command in terminal (for linux only)
cpp --version
In file included from /usr/include/c++/4.8.2/locale:41:0,
from /usr/include/c++/4.8.2/iomanip:43,
from [...omitted by myself as it is irrelevant]
/usr/include/c++/4.8.2/bits/locale_facets_nonio.h:59:39: error: ‘locale’ has not been declared
struct __timepunct_cache : public locale::facet
Above is the first error in my build log.
I didn't try to compile glibc/gcc myself, and I installed them via yum.
One fishy thing I found is:
$ ll /usr/include/c++/
total 4
drwxr-xr-x. 12 root root 4096 Dec 17 14:16 4.8.2
lrwxrwxrwx 1 root root 5 Dec 17 14:16 4.8.5 -> 4.8.2
$
And yum showed only 1 version of gcc:
$ yum info gcc-c++
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.uhost.hk
* epel: mirrors.hustunique.com
* extras: centos.uhost.hk
* updates: centos.uhost.hk
Installed Packages
Name : gcc-c++
Arch : x86_64
Version : 4.8.5
Release : 4.el7
Size : 16 M
Repo : installed
From repo : base
Summary : C++ support for GCC
URL : http://gcc.gnu.org
License : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Description : This package adds C++ support to the GNU Compiler Collection.
: It includes support for most of the current C++ specification,
: including templates and exception handling.
Any idea how to verify the headers in /usr/include/c++/4.8.2 is indeed from 4.8.5 package?
Thanks in advance.
P.S. I think probably glibc is irrelevant but here is the info:
$ ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
The symlink to the 4.8.2 directory is nothing to worry about, it's normal for the libstdc++ headers on Red Hat Enterprise Linux (and therefore CentOS) to be arranged like that.
gcc --version will tell you the version of the gcc executable in your path.
rpm -q libstdc++-devel will tell you the version of the package that owns the C++ standard library headers.
rpm -ql libstdc++-devel will list the files installed by that package, which will include the files under /usr/include/c++/4.8.2
rpm --verify libstdc++-devel will check that you haven't messed up the C++ headers by replacing them with something else.
The error is more concerning, that implies you have messed something up. My guess would be it's in the from [...omitted by myself as it is irrelevant] part, which may actually be very relevant. std::locale should be declared in <bits/locale_classes.h> which is included before <bits/locale_facets_nonio.h>, so if it wasn't declared my guess is that you have some header that defines _LOCALE_CLASSES_H and prevents the standard library header from being read. Do not define include guards that start with underscores, they are reserved names.
I am not quite sure but below is more information
Stackoverflow: version of libc
$ /lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu EGLIBC 2.19-0ubuntu6) stable release version 2.19, by Roland McGrath et al.
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.8.2.
Compiled on a Linux 3.13.9 system on 2014-04-12.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/eglibc/+bugs>.
mandar#ubuntu:~/Desktop$
Since you are using Linux you can try
ldd --version
I downloaded the disruptor sources from here:
https://github.com/fsaintjacques/disruptor--
I then tried but get the given error. Is there something that I am missing?
autoconf configure.ac > configure
configure.ac:9: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:19: error: possibly undefined macro: AC_CXX_COMPILE_STDCXX_0X
gcc version
gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
autoconf version
autoconf --version
autoconf (GNU Autoconf) 2.63
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later
<http://gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
Ask the developer to provide a bootstrap script and/or build instructions. Most likely you need:
aclocal
autoconf
automake -a
./configure
make
With possibly some non-default options (e.g. add --foreign to the automake invocation).
I am trying to understand the difference between 'gmake' and 'make'?
On my linux box they are identical:
% gmake --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
% make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
I am guessing this isn't the same on all platforms?
Is there a good reason to use one over the other?
Is there some historical significance to why there are the two names?
'gmake' refers specifically to GNU make. 'make' refers to the system's default make implementation; on most Linux distros this is GNU make, but on other unixes, it could refer to some other implementation of make, such as BSD make, or the make implementations of various commercial unixes.
The language accepted by GNU make is a superset of the one supported by the traditional make utility.
By using 'gmake' specifically you can use GNU make extensions without worrying about them being misinterpreted by some other make implementation.
On my system no difference (gmake is soft link to make):
-> ls -l $(which gmake make)
lrwxrwxrwx 1 root root 4 Jun 5 2007 /usr/bin/gmake -> make
-rwxr-xr-x 1 root root 168976 Jul 13 2006 /usr/bin/make
gmake stands for GNU make. There're different implementations of make. On Linux machine most probably make will by GNU and to make user's life isier make is soft linked to gmake.
The usual "opposite" of gmake is BSD make, which will tend to be make on BSD systems, unsurprisingly. If you want to see what BSD make is like, on Debian derivatives it's available as apt-get install pmake.
Apparently, GNU make is practically universal now, so there should almost never be a difference.