Need help with compiling NVIDIA_GPU_Computing_SDK

Hi guys,

I am trying to get barra-sim running on OpenSUSE 12.3 x64. I downloaded cuda sdk 2.3 because it is the lastest version of cuda toolkit supported by barra-sim.
When I try to compile the sample code in NVIDIA_GPU_Computing_SDK it give me the following error saying “__builtin_bswap32” is undefined. Is there any way to fix this problem?

Thanks


make -C src/BlackScholes/
make[1]: Entering directory `/home/cheng/NVIDIA_GPU_Computing_SDK/C/src/BlackScholes'
/usr/include/bits/byteswap.h(47): error: identifier "__builtin_bswap32" is undefined

/usr/include/bits/byteswap.h(111): error: identifier "__builtin_bswap64" is undefined

2 errors detected in the compilation of "/tmp/tmpxft_00003c03_00000000-4_BlackScholes.cpp1.ii".
make[1]: *** [obj/release/BlackScholes.cu.o] Error 255
make[1]: Leaving directory `/home/cheng/NVIDIA_GPU_Computing_SDK/C/src/BlackScholes'
make: *** [src/BlackScholes/Makefile.ph_build] Error 2

On my 12.2 system, this is in linux-glibc-devel-3.4.0-2.1.23.noarch (the
include file is /usr/include/asm-tile/swab.h).

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Thank you for your reply. However, it did not solve the problem I have. My openSUSE 12.3 has linux-glibc-devel-3.7.1-2.1.3.noarch installed. and the swab.h file only has couple of lines:


#ifndef _ASM_TILE_SWAB_H
#define _ASM_TILE_SWAB_H

/* Tile gcc is always >= 4.3.0, so we use __builtin_bswap. */
#define __arch_swab32(x) __builtin_bswap32(x)
#define __arch_swab64(x) __builtin_bswap64(x)
#define __arch_swab16(x) (__builtin_bswap32(x) >> 16)

#endif

The code that gives me error:


#ifdef __GNUC__
# if __GNUC_PREREQ (4, 3)
static __inline unsigned int
__bswap_32 (unsigned int __bsx)
{
  return __builtin_bswap32 (__bsx);   <---
}
# elif __GNUC__ >= 2

I tried to replace __builtin_bswap32(__bsx) with __arch_swab32(__bsx), but it didn’t do anything to the problem

Hi
Google on the error? Looks like it may only compile with an older version of gcc;


if __GNUC_PREREQ (4, 3)

http://moss.csc.ncsu.edu/~mueller/cluster/nvidia/2.3/cudasdk_release_notes_linux.txt

Only supports openSUSE 11.1 and gcc 3.4 or 4…

Yes, I have copy and paste the error to google, but didn’t get much from it. Is there anyway to make it compile with a newer version of gcc?
dsgafThe goal of this project I try to do is to make barra-sim more portable and compatible with newer technology, but I am still fairly new to c and c++ so I don’t know much about the compatibility issues.

Hi
Are you trying to build this?
barra-sim - Barra: a simulator of CUDA GPU architectures - Google Project Hosting

I have already built barra-sim. I just want to test it to see if it is working. The latest version of cuda toolkit it supports is 2.3, so I kind of have to get cuda sdk 2.3 build right now.

Hi
Looks like there are 12.3 gcc4.3.4 packages here;
https://build.opensuse.org/package/binaries?package=gcc43&project=openSUSE%3A12.3&repository=standard

They aren’t on the mirrors, so you will need to click on the files you need and install manually. Then you would need to export the gcc version (isn’t this done via a nvcc option?) so it points to the gcc version when building.

Am 02.04.2013 06:16, schrieb malcolmlewis:
>
> Kaito_Hacker;2543664 Wrote:
>> I have already built barra-sim. I just want to test it to see if it is
>> working. The latest version of cuda toolkit it supports is 2.3, so I
>> kind of have to get cuda sdk 2.3 build right now.
> Hi
> Looks like there are 12.3 gcc4.3.4 packages here;
> http://tinyurl.com/coyb5dl
>
> They aren’t on the mirrors, so you will need to click on the files you
> need and install manually. Then you would need to export the gcc version
> (isn’t this done via a nvcc option?) so it points to the gcc version
> when building.
>
>
You are completely right about the older gcc to use, that was already
needed in 12.2 for CUDA and discussed here
http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/480602-easy-downgrade-12-2-12-1-a.html
It should really work the same on 12.3 (not yet tested by me).


PC: oS 12.3 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.10.0 | GTX 650 Ti
ThinkPad E320: oS 12.3 x86_64 | i3@2.30GHz | 8GB | KDE 4.10.0 | HD 3000
HannsBook: oS 12.3 x86_64 | SU4100@1.3GHz | 2GB | KDE 4.10.0 | GMA4500

On Tue 02 Apr 2013 09:04:14 AM CDT, Martin Helm wrote:

Am 02.04.2013 06:16, schrieb malcolmlewis:
>
> Kaito_Hacker;2543664 Wrote:
>> I have already built barra-sim. I just want to test it to see if it
>> is working. The latest version of cuda toolkit it supports is 2.3,
>> so I kind of have to get cuda sdk 2.3 build right now.
> Hi
> Looks like there are 12.3 gcc4.3.4 packages here;
> http://tinyurl.com/coyb5dl
>
> They aren’t on the mirrors, so you will need to click on the files you
> need and install manually. Then you would need to export the gcc
> version (isn’t this done via a nvcc option?) so it points to the gcc
> version when building.
>
>
You are completely right about the older gcc to use, that was already
needed in 12.2 for CUDA and discussed here
http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/480602-easy-downgrade-12-2-12-1-a.html
It should really work the same on 12.3 (not yet tested by me).

Hi
Ahh, didn’t do a search :wink: I built barra-sim as a rpm, so I normally
export on the fly, rather than a symlink;


export CC=/usr/bin/gcc-4.3
export CXX=/usr/bin/g++-4.3


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 19:42, 4 users, load average: 0.12, 0.09, 0.06
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Ironlake Mobile

Am 02.04.2013 14:13, schrieb malcolmlewis:
> Hi
> Ahh, didn’t do a search :wink: I built barra-sim as a rpm, so I normally
> export on the fly, rather than a symlink;
> export CC=/usr/bin/gcc-4.3
> export CXX=/usr/bin/g+±4.3

The Cuda installer did not like that back then (I used the full Cuda 5
package which includes also the SDK), I have not tried again in the
meantime, maybe it is better now.
Worth a try at least, I admit the symbolic link was nothing than an ugly
hack to get it done.


PC: oS 12.3 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.10.0 | GTX 650 Ti
ThinkPad E320: oS 12.3 x86_64 | i3@2.30GHz | 8GB | KDE 4.10.0 | HD 3000
HannsBook: oS 12.3 x86_64 | SU4100@1.3GHz | 2GB | KDE 4.10.0 | GMA4500

Where can I download those packages? I can’t find it in the download repository.

On Wed 03 Apr 2013 02:16:02 PM CDT, Kaito Hacker wrote:

malcolmlewis;2543672 Wrote:
> Hi
> Looks like there are 12.3 gcc4.3.4 packages here;
> http://tinyurl.com/coyb5dl
>
> They aren’t on the mirrors, so you will need to click on the files you
> need and install manually. Then you would need to export the gcc
> version (isn’t this done via a nvcc option?) so it points to the gcc
> version when building.

Where can I download those packages? I can’t find it in the download
repository.

Hi
Correct, they don’t appear to be synced. You need to click on the rpm
names for your arch, it will take you to another page with the file
information. At the top, the name is a download link (Detailed
information). You will need to create an OBS account though…


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 1 day 23:06, 4 users, load average: 0.04, 0.03, 0.05
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Ironlake Mobile

So I finally got gcc-4.3 and g+±4.3 installed.
I tried

export CC=/usr/bin/gcc-4.3 
export CXX=/usr/bin/g++-4.3

but I still have the same error identifier “__builtin_bswap32” and “__builtin_bswap64” is undefined

I also tried to manually change the CXX and CC in common.mk file to /usr/bin/g+±4.3 and /usr/bin/gcc-4.3, but it still didn’t solve the problem.

I didn’t find the option in nvcc to point to a different gcc compiler though


#ifdef __GNUC__
# if __GNUC_PREREQ (4, 3)
+ extern unsigned int __builtin_bswap32(unsigned int);
+ extern unsigned long long __builtin_bswap64(unsigned long long);
static __inline unsigned int
__bswap_32 (unsigned int __bsx)
{
  return __builtin_bswap32 (__bsx);
}
# elif __GNUC__ >= 2

So I have add those two line I found online to the code and the error disappeared, did it actually fix the problem? The place I found this two line didn’t have clear explanation on what they does and how they fix the problem so I am quite sure if this actually works or not.

On Fri 05 Apr 2013 04:46:02 PM CDT, Kaito Hacker wrote:

malcolmlewis;2544116 Wrote:
> Hi
> Correct, they don’t appear to be synced. You need to click on the rpm
> names for your arch, it will take you to another page with the file
> information. At the top, the name is a download link (Detailed
> information). You will need to create an OBS account though…
>
>
> –
> Cheers Malcolm °¿° (Linux Counter #276890)
> openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
> up 1 day 23:06, 4 users, load average: 0.04, 0.03, 0.05
> CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Ironlake Mobile

Code:

#ifdef GNUC

if __GNUC_PREREQ (4, 3)

  • extern unsigned int __builtin_bswap32(unsigned int);
  • extern unsigned long long __builtin_bswap64(unsigned long long);
    static __inline unsigned int
    __bswap_32 (unsigned int __bsx)
    {
    return __builtin_bswap32 (__bsx);
    }

elif GNUC >= 2


So I have add those two line I found online to the code and the error
disappeared, did it actually fix the problem? The place I found this two
line didn’t have clear explanation on what they does and how they fix
the problem so I am quite sure if this actually works or not.

Hi
Not sure, you might want to check at http://gcc.gnu.org/
probably some stricter rules. Find the porting pages which generally
list the changes from one release to the next. For example;
http://gcc.gnu.org/gcc-4.3/porting_to.html


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 4 days 0:38, 3 users, load average: 0.13, 0.13, 0.08
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Ironlake Mobile