I want to do some parallel programming on my nvidia GPU, and for that I need cuda. The latest is cuda 7.5 and that requires gcc 4.9. I installed cuda on my machine, but little did I know that fedora 24, which I recently installed, came with gcc 6.1. I wasn't able to compile any of the cuda examples. I asked on the nvidia forums about this and the next cuda (version 8.0) will require gcc-5.3 or so. No indication when cuda will work with gcc-6.1.
So what do I do now? From some posts I read it appears that debian provides a gcc49 package, and so I hoped fedora would provide one too, but no such luck. Can I rebuild the gcc-4.9 rpm on F24 without messing up the stock gcc-6.1? Or, can I convert the gcc49.deb package into the equivalent rpm? I can try these things and try to be careful not to mess up, but I was wondering if anyone had any experience with this or any suggestions. Thanks!
IIRC the cuda installer lets you override the check for the gcc version (try running the installer ".run" file with the "--help" option).
Note that overrides the gcc check during installation--there's no guarantee that compilations will work. Cuda uses certain gcc flags that may be deprecated or non-existent in newer gcc implementations.
Rick Stevens, Systems Engineer AllDigital, Inc. ________________________________ From: Amadeus W.M. amadeus84@verizon.net Sent: Sunday, July 31, 2016 9:08:35 AM To: users@lists.fedoraproject.org Subject: gcc 4.9
I want to do some parallel programming on my nvidia GPU, and for that I need cuda. The latest is cuda 7.5 and that requires gcc 4.9. I installed cuda on my machine, but little did I know that fedora 24, which I recently installed, came with gcc 6.1. I wasn't able to compile any of the cuda examples. I asked on the nvidia forums about this and the next cuda (version 8.0) will require gcc-5.3 or so. No indication when cuda will work with gcc-6.1.
So what do I do now? From some posts I read it appears that debian provides a gcc49 package, and so I hoped fedora would provide one too, but no such luck. Can I rebuild the gcc-4.9 rpm on F24 without messing up the stock gcc-6.1? Or, can I convert the gcc49.deb package into the equivalent rpm? I can try these things and try to be careful not to mess up, but I was wondering if anyone had any experience with this or any suggestions. Thanks!
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://lists.fedoraproject.org/admin/lists/users@lists.fedoraproject.org Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
On Sun, 31 Jul 2016 16:36:10 +0000, Rick Stevens wrote:
IIRC the cuda installer lets you override the check for the gcc version (try running the installer ".run" file with the "--help" option).
Note that overrides the gcc check during installation--there's no guarantee that compilations will work. Cuda uses certain gcc flags that may be deprecated or non-existent in newer gcc implementations.
Rick Stevens, Systems Engineer AllDigital, Inc. ________________________________
NVIDIA provides a cuda rpm repository and I installed everything from there with dnf, so it installed with whatever defaults it came with. And, as you said, even if it doesn't check for the compiler, it won't necessarily compile. I'm really looking for a clean way of installing gcc-4.9.
On Sun, 31 Jul 2016 17:24:16 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote:
On Sun, 31 Jul 2016 16:36:10 +0000, Rick Stevens wrote:
IIRC the cuda installer lets you override the check for the gcc version (try running the installer ".run" file with the "--help" option).
Note that overrides the gcc check during installation--there's no guarantee that compilations will work. Cuda uses certain gcc flags that may be deprecated or non-existent in newer gcc implementations.
Rick Stevens, Systems Engineer AllDigital, Inc. ________________________________
NVIDIA provides a cuda rpm repository and I installed everything from there with dnf, so it installed with whatever defaults it came with. And, as you said, even if it doesn't check for the compiler, it won't necessarily compile. I'm really looking for a clean way of installing gcc-4.9.
A possible workaround would be to set the version of C that you want gcc to adhere to. I think there are flags in gcc that tell it to use, say, C99. You'd have to determine which standard gcc 4.9 aligned with, and use that one.
Another possibility is to get the gcc 4.9 src.rpm from koji, build it as an rpm that installs itself in your home directory. Then, you would tell cuda to invoke that version of gcc. You could also just extract the tar file from the src.rpm and build it. It's a major undertaking, since it does several compiles. But the packages won't co-exist on the system because they'll have file collisions, especially serious in the libraries. I think you'd also have to compile statically, so that the executable built with gcc 4.9 didn't try to use the dynamic libraries from gcc 6.1.
http://koji.fedoraproject.org/koji/packageinfo?buildStart=100&packageID=...
I haven't ever used it, but I think that the program mock is specifically designed to work for situations like this. It builds a chroot jail, creates the required environment, and does everything there with the different build environment. So, you could build cuda using mock, but you'd have to run it in the jail so you used the appropriate libraries. Or, again, statically link it.
Description : Mock takes an SRPM and builds it in a chroot.
Interesting problem.
On Sun, 31 Jul 2016 11:06:18 -0700 stan stanl-fedorauser@vfemail.net wrote:
On Sun, 31 Jul 2016 17:24:16 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote:
On Sun, 31 Jul 2016 16:36:10 +0000, Rick Stevens wrote:
IIRC the cuda installer lets you override the check for the gcc version (try running the installer ".run" file with the "--help" option).
Note that overrides the gcc check during installation--there's no guarantee that compilations will work. Cuda uses certain gcc flags that may be deprecated or non-existent in newer gcc implementations.
Rick Stevens, Systems Engineer AllDigital, Inc. ________________________________
NVIDIA provides a cuda rpm repository and I installed everything from there with dnf, so it installed with whatever defaults it came with. And, as you said, even if it doesn't check for the compiler, it won't necessarily compile. I'm really looking for a clean way of installing gcc-4.9.
Some further thoughts. The 4.9 compiler is from F21. So you could build a virtual machine of F21 to use for this, or do a minimal install just for this purpose. I can't remember the link, but Fedora keeps a snapshot of the last version of each version, so there is an F21 repository with all the software in it, current at the end of the version. Then just install from the cuda repository, and off you go.
This would be a lot easier than trying to bolt gcc 4.9 onto the latest Fedora.
On Sun, 2016-07-31 at 11:32 -0700, stan wrote:
On Sun, 31 Jul 2016 11:06:18 -0700 stan stanl-fedorauser@vfemail.net wrote:
On Sun, 31 Jul 2016 17:24:16 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote:
On Sun, 31 Jul 2016 16:36:10 +0000, Rick Stevens wrote:
IIRC the cuda installer lets you override the check for the gcc version (try running the installer ".run" file with the " --help" option).
Note that overrides the gcc check during installation--there's no guarantee that compilations will work. Cuda uses certain gcc flags that may be deprecated or non-existent in newer gcc implementations.
Rick Stevens, Systems Engineer AllDigital, Inc. ________________________________
NVIDIA provides a cuda rpm repository and I installed everything from there with dnf, so it installed with whatever defaults it came with. And, as you said, even if it doesn't check for the compiler, it won't necessarily compile. I'm really looking for a clean way of installing gcc-4.9.
Some further thoughts. The 4.9 compiler is from F21. So you could build a virtual machine of F21 to use for this, or do a minimal install just for this purpose. I can't remember the link, but Fedora keeps a snapshot of the last version of each version, so there is an F21 repository with all the software in it, current at the end of the version. Then just install from the cuda repository, and off you go.
This would be a lot easier than trying to bolt gcc 4.9 onto the latest Fedora.
Another alternative would be to just get the source from https://www.gn u.org/software/gcc/ and build a local copy in /usr/local or your home directory. That would avoid all the conflicts that RPMs generate with the system GCC. I did that once some time back and it's not that hard.
On Sun, 31 Jul 2016 11:32:03 -0700, stan wrote:
On Sun, 31 Jul 2016 11:06:18 -0700 stan stanl-fedorauser@vfemail.net wrote:
On Sun, 31 Jul 2016 17:24:16 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote:
On Sun, 31 Jul 2016 16:36:10 +0000, Rick Stevens wrote:
IIRC the cuda installer lets you override the check for the gcc version (try running the installer ".run" file with the "--help" option).
Note that overrides the gcc check during installation--there's no guarantee that compilations will work. Cuda uses certain gcc flags that may be deprecated or non-existent in newer gcc implementations.
Rick Stevens, Systems Engineer AllDigital, Inc. ________________________________
NVIDIA provides a cuda rpm repository and I installed everything from there with dnf, so it installed with whatever defaults it came with. And, as you said, even if it doesn't check for the compiler, it won't necessarily compile. I'm really looking for a clean way of installing gcc-4.9.
Some further thoughts. The 4.9 compiler is from F21. So you could build a virtual machine of F21 to use for this, or do a minimal install just for this purpose. I can't remember the link, but Fedora keeps a snapshot of the last version of each version, so there is an F21 repository with all the software in it, current at the end of the version. Then just install from the cuda repository, and off you go.
This would be a lot easier than trying to bolt gcc 4.9 onto the latest Fedora. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://lists.fedoraproject.org/admin/lists/users@lists.fedoraproject.org Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Unfortunately nothing worked.
In the cuda distribution there is a host_config.h file which contains the following lines:
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9)
#error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */
This checks the version of the compiler and triggers an error with gcc-6.1 even if I pass --std=gnu89 which was the default C standard in gcc-4.9.
Second, the gcc-4.9.src.rpm did not build with gcc-6.1. Initially it did not build because it required /lib/libc.so.6 and /usr/lib/libc.so.6 (in addition to the lib64 versions), so I just removed /lib/libc.so.6 and /usr/lib/libc.so.6 from the gcc.spec file. The rebuild process did start after that, and I thought it would go through, but it bombed out with some compilation error which I don't feel inclined to fix, as it must be due to some incompatibility between my gcc-6.1 and what I'm trying to compile. I might get it to compile if I can specify gcc --std=gnu89 when compiling the old compiler, but I don't know how to pass compiler options to rpmbuild.
Third, I was only able to find a Fedora-21-Live image and I created a virtual box from it, booted that up and installed to disk. But, as one might expect, gnome-boxes only knew about the Live VM, and each time I would boot it up, it would boot up the live image, not the one I installed to disk. Not sure how install to disk works in a VM.
On 01.08.2016 06:30, Amadeus W.M. wrote: [...]
In the cuda distribution there is a host_config.h file which contains the following lines:
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9)
#error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */
[...]
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux
Table 1. Native Linux Distribution Support in CUDA 7.0 Distribution Kernel GCC GLIBC CentOS 7.x 3.10 4.8.2 2.17
kernel-3.10.0-327.22.2.el7.x86_64 gcc-4.8.5-4.el7.x86_64 glibc-2.17-106.el7_2.6.x86_64
On Mon, 1 Aug 2016 04:30:03 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote: [snip]
Unfortunately nothing worked.
In the cuda distribution there is a host_config.h file which contains the following lines:
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9)
#error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */
This checks the version of the compiler and triggers an error with gcc-6.1 even if I pass --std=gnu89 which was the default C standard in gcc-4.9.
You don't have write access to that file? If you do, you could just comment out that check.
Second, the gcc-4.9.src.rpm did not build with gcc-6.1. Initially it did not build because it required /lib/libc.so.6 and /usr/lib/libc.so.6 (in addition to the lib64 versions), so I just removed /lib/libc.so.6 and /usr/lib/libc.so.6 from the gcc.spec file. The rebuild process did start after that, and I thought it would go through, but it bombed out with some compilation error which I don't feel inclined to fix, as it must be due to some incompatibility between my gcc-6.1 and what I'm trying to compile. I might get it to compile if I can specify gcc --std=gnu89 when compiling the old compiler, but I don't know how to pass compiler options to rpmbuild.
It's been awhile, but IIRC most spec files have a COPTIONS variable that appends to (and overrides earlier options, since that is how gcc works) the default options in the rpmbuild setup file. There are a set of default options for rpmbuild common to fedora, but I took a quick look and couldn't find it, though I've seen it before. If you can find that file, you could change the options there instead.
Third, I was only able to find a Fedora-21-Live image and I created a virtual box from it, booted that up and installed to disk. But, as one might expect, gnome-boxes only knew about the Live VM, and each time I would boot it up, it would boot up the live image, not the one I installed to disk. Not sure how install to disk works in a VM.
Outside my area of expertise, maybe someone else can help you.
On Mon, 1 Aug 2016 04:30:03 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote:
Third, I was only able to find a Fedora-21-Live image and I created a virtual box from it, booted that up and installed to disk. But, as one might expect, gnome-boxes only knew about the Live VM, and each time I would boot it up, it would boot up the live image, not the one I installed to disk. Not sure how install to disk works in a VM.
I would just use BFO to install a minimal version of F21. It has the archive repository locations built in, and invokes anaconda, so it is just like installing any version of Fedora directly. Except it is entirely over the web.
On 08/01/2016 06:30 AM, Amadeus W.M. wrote:
Third, I was only able to find a Fedora-21-Live image and I created a virtual box from it, booted that up and installed to disk. But, as one might expect, gnome-boxes only knew about the Live VM, and each time I would boot it up, it would boot up the live image, not the one I installed to disk. Not sure how install to disk works in a VM.
Might be as simple as telling the VM to eject the CD before booting the guest.
On Mon, 01 Aug 2016 09:34:51 -0700, stan wrote:
On Mon, 1 Aug 2016 04:30:03 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote: [snip]
Unfortunately nothing worked.
In the cuda distribution there is a host_config.h file which contains the following lines:
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9)
#error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */
This checks the version of the compiler and triggers an error with gcc-6.1 even if I pass --std=gnu89 which was the default C standard in gcc-4.9.
You don't have write access to that file? If you do, you could just comment out that check.
I do have write access to that file, but I imagine that compiler check is there for a reason, so I would rather use the right compiler than not check for it. Chances are the cuda code won't compile (correctly) if I skip the check. Still, maybe worth a shot.
On Mon, 1 Aug 2016 22:21:58 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote:
On Mon, 01 Aug 2016 09:34:51 -0700, stan wrote:
On Mon, 1 Aug 2016 04:30:03 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote: [snip]
Unfortunately nothing worked.
In the cuda distribution there is a host_config.h file which contains the following lines:
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9)
#error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */
This checks the version of the compiler and triggers an error with gcc-6.1 even if I pass --std=gnu89 which was the default C standard in gcc-4.9.
You don't have write access to that file? If you do, you could just comment out that check.
I do have write access to that file, but I imagine that compiler check is there for a reason, so I would rather use the right compiler than not check for it. Chances are the cuda code won't compile (correctly) if I skip the check. Still, maybe worth a shot.
But that's why you put in the --std=gnu89 flag. You're telling gcc to pretend that it is gcc 4.9, even though it's 6.1, so you are manually doing the check. That is, even though the compiler is 6.1, it's going to emulate 4.9.
On Mon, 01 Aug 2016 17:23:43 -0700, stan wrote:
On Mon, 1 Aug 2016 22:21:58 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote:
On Mon, 01 Aug 2016 09:34:51 -0700, stan wrote:
On Mon, 1 Aug 2016 04:30:03 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote: [snip]
Unfortunately nothing worked.
In the cuda distribution there is a host_config.h file which contains the following lines:
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9)
#error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */
This checks the version of the compiler and triggers an error with gcc-6.1 even if I pass --std=gnu89 which was the default C standard in gcc-4.9.
You don't have write access to that file? If you do, you could just comment out that check.
I do have write access to that file, but I imagine that compiler check is there for a reason, so I would rather use the right compiler than not check for it. Chances are the cuda code won't compile (correctly) if I skip the check. Still, maybe worth a shot.
But that's why you put in the --std=gnu89 flag. You're telling gcc to pretend that it is gcc 4.9, even though it's 6.1, so you are manually doing the check. That is, even though the compiler is 6.1, it's going to emulate 4.9.
That's what I thought too, but try this:
// Compile as // g++ -o gnuc gnuc.cpp // then as // g++ --std=gnu++11 -o gnuc gnuc.cpp
#include <iostream> #include <cstdlib>
using namespace std;
int main(int argc, char * argv[]) { cout << __GNUC__ << "." << __GNUC_MINOR__ << endl; return 0; }
It always outputs 6.1, whether or not you compile it with the --std flag. And if you think about it, __GNUC__ is probably a macro defined in the compiler at compile time, so it can't possibly change at run time. Haven't checked, but it's a good guess.
On Tue, 2 Aug 2016 02:04:13 +0000 (UTC) "Amadeus W.M." amadeus84@verizon.net wrote:
[snip]
That's what I thought too, but try this:
// Compile as // g++ -o gnuc gnuc.cpp // then as // g++ --std=gnu++11 -o gnuc gnuc.cpp
#include <iostream> #include <cstdlib>
using namespace std;
int main(int argc, char * argv[]) { cout << __GNUC__ << "." << __GNUC_MINOR__ << endl; return 0; }
It always outputs 6.1, whether or not you compile it with the --std flag. And if you think about it, __GNUC__ is probably a macro defined in the compiler at compile time, so it can't possibly change at run time. Haven't checked, but it's a good guess.
Yes, that makes sense. But I don't think it means that it hasn't made the compile adhere to the different standard.
Using a later compiler on earlier code is not optimal, that's for sure. And you're right, it's hard to trust that any executable under that circumstance is functioning correctly, since it could introduce subtle bugs. For example, firefox had some serious problems with gcc6 because it changed the way the compiler treated certain constructs of C++ in the latest standard. What had been perfectly valid code became invalid under the new rules.
On Mon, 01 Aug 2016 14:16:57 +0200, poma wrote:
On 01.08.2016 06:30, Amadeus W.M. wrote: [...]
In the cuda distribution there is a host_config.h file which contains the following lines:
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9)
#error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */
[...]
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux
Table 1. Native Linux Distribution Support in CUDA 7.0 Distribution Kernel GCC GLIBC CentOS 7.x 3.10 4.8.2 2.17
kernel-3.10.0-327.22.2.el7.x86_64 gcc-4.8.5-4.el7.x86_64 glibc-2.17-106.el7_2.6.x86_64
--
Good suggestion! If only worked in a virtual machine. Amazon does it, so it might.