11 Replies Latest reply on Aug 7, 2008 12:22 AM by michael.chu

    Problem building sample code

    jski

      I'm trying (for the 1st time) to make simple_matmult not using GPU emulation and I get the following errors:

      In file included from ../../../sdk/include/brook/brt.hpp:56,
                       from ../../common/common.h:3,
                       from ../../common/common.cpp:4:
      ../../../sdk/include/brook/brtvector.hpp:190: error: explicit template specialization cannot have a storage class
      ../../../sdk/include/brook/brtvector.hpp:191: error: explicit template specialization cannot have a storage class
      ../../../sdk/include/brook/brtvector.hpp:192: error: explicit template specialization cannot have a storage class
      ../../../sdk/include/brook/brtvector.hpp:193: error: explicit template specialization cannot have a storage class
      ../../../sdk/include/brook/brtvector.hpp:194: error: explicit template specialization cannot have a storage class
      ../../../sdk/include/brook/brtvector.hpp:195: error: explicit template specialization cannot have a storage class
      ../../common/common.cpp: In function ‘float* allocate_mat_f(unsigned int, unsigned int)’:
      ../../common/common.cpp:397: error: ‘memset’ was not declared in this scope
      ../../common/common.cpp: In function ‘void normalize_mat_f(float*, unsigned int, unsigned int, float, float)’:
      ../../common/common.cpp:427: error: ‘INT_MAX’ was not declared in this scope
      ../../common/common.cpp:428: error: ‘INT_MIN’ was not declared in this scope
      ../../common/common.cpp: In function ‘float2* allocate_mat_f2(unsigned int, unsigned int)’:
      ../../common/common.cpp:531: error: ‘memset’ was not declared in this scope
      ../../common/common.cpp: In function ‘float3* allocate_mat_f3(unsigned int, unsigned int)’:
      ../../common/common.cpp:639: error: ‘memset’ was not declared in this scope
      ../../common/common.cpp: In function ‘float4* allocate_mat_f4(unsigned int, unsigned int)’:
      ../../common/common.cpp:759: error: ‘memset’ was not declared in this scope
      ../../common/common.cpp: In function ‘void normalize_mat_f4(float4*, unsigned int, unsigned int, float, float)’:
      ../../common/common.cpp:771: error: ‘INT_MAX’ was not declared in this scope
      ../../common/common.cpp:772: error: ‘INT_MIN’ was not declared in this scope
      ../../common/common.cpp: In function ‘double* allocate_mat_d(unsigned int, unsigned int)’:
      ../../common/common.cpp:911: error: ‘memset’ was not declared in this scope
      ../../common/common.cpp: In function ‘void normalize_mat_d(double*, unsigned int, unsigned int, double, double)’:
      ../../common/common.cpp:940: error: ‘INT_MAX’ was not declared in this scope
      ../../common/common.cpp:941: error: ‘INT_MIN’ was not declared in this scope
      ../../common/common.cpp: In function ‘int* allocate_mat_i(unsigned int, unsigned int)’:
      ../../common/common.cpp:1071: error: ‘memset’ was not declared in this scope
      ../../common/common.cpp: In function ‘void normalize_mat_i(int*, unsigned int, unsigned int, int, int)’:
      ../../common/common.cpp:1100: error: ‘INT_MAX’ was not declared in this scope
      ../../common/common.cpp:1101: error: ‘INT_MIN’ was not declared in this scope
      make: *** [built_d/common.o] Error 1

      I using openSuSE 11.  Any ideas?

      jski

      PS> And yes, I set:

      export LD_LIBRARY_PATH=/usr/local/amdcal/lib64/:/usr/local/amdbrook/sdk/lib:$LD_LIBRARY_PATH

        • Problem building sample code
          jski

          Could this be the problem:

          On openSuSE 11 gcc- --version returns:

          gcc (SUSE Linux) 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]


          on openSuSE 10.2 (where is builds):

          gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)


          ---jski

            • Problem building sample code
              uytvbn

              Yes, 4.3 is more strict when compiling c++ code. You can find more information here. Patch below.

               

              Regards,

              Jarek

               

              --- amdbrook/samples/common/common.cpp    2008-05-23 01:20:18.000000000 +0200
              +++ amdbrook.new/samples/common/common.cpp    2008-08-01 21:55:49.000000000 +0200
              @@ -1,7 +1,10 @@
              +#include <limits.h>
               #include <stdio.h>
               #include <stdlib.h>
              +#include <string.h>
               #include <math.h>
               #include "common.h"
              +
               typedef struct tagBITMAPFILEHEADER {
                   unsigned short bfType;
                   unsigned int bfSize;
              --- amdbrook/sdk/include/brook/brtvector.hpp    2008-05-23 01:20:18.000000000 +0200
              +++ amdbrook.new/sdk/include/brook/brtvector.hpp    2008-08-01 21:59:01.000000000 +0200
              @@ -185,7 +185,7 @@
               template <class T> static typename GetValueOf<T>::type GetAt (const T& in,int i) {
                   return in.getAt(i);
               }
              -#define SPECIALGETAT(TYP) template <> static TYP GetAt (const TYP& in,int UNUSED(i)) {return in;}
              +#define SPECIALGETAT(TYP) template <> TYP GetAt (const TYP& in,int UNUSED(i)) {return in;}
               
               SPECIALGETAT(int)
               SPECIALGETAT(unsigned int)

                • Problem building sample code
                  jski

                  First, THANKS!

                  Second, the patch worked fine ... for simple_matmult, not so well for optimized_matmult:

                  built_d/optimized_matmult.cpp: In function ‘void divideMatrix(float*, float**, unsigned int, unsigned int, unsigned int)’:
                  built_d/optimized_matmult.cpp:22: error: ‘memcpy’ was not declared in this scope
                  built_d/optimized_matmult.cpp: In function ‘void combineMatrix(float**, float*, unsigned int, unsigned int, unsigned int)’:
                  built_d/optimized_matmult.cpp:36: error: ‘memcpy’ was not declared in this scope
                  make: *** [built_d/optimized_matmult.o] Error 1

                  I have to assume that if I persist with SuSE 11.0 (and gcc 4.3) I'll constantly be fighting  these probkems?

                  ---jski

                    • Problem building sample code
                      uytvbn

                      That depends. Gcc 4.3 is fairly new and a lot of c++ programs are not yet updated to compile with it. On the other hand fixing this is fairly trivial (it's thoroughly described in the document linked in my last post).

                      As for optimized_matmult, you should add string.h to the list of includes (or cstring, which is a bit more c++-ish).

                        • Problem building sample code
                          jski

                          Thanks again but ...

                          Yes, I agree that's an easy one to fix (and I did) BUT am I going to get into some other problems by sticking with gcc 4.3 which aren't as easily fixed?

                          BTW, I still haven't got the driver (Catalyst 8.6) to work with SuSE 11.0 (or 10.2 for that matter).  Builds fine but when I execute aticonfig --initial and reboot all I get is a blank screen.

                          ---jski

                            • Problem building sample code
                              uytvbn

                              There shouldn't be any problems. Afaik the c++ abi hasn't been changed since gcc 3.4/4.0.

                              I too get blank screen with Catalyst 8.6. The only driver which works with my card (4850) is 8.7 (besides 8.6 I've also tried the one bundled with the SDK), but unfortunately it doesn't seem to work with CAL. So basically I'm stuck with CPU emulation.

                                • Problem building sample code
                                  udeepta@amd

                                   

                                  Originally posted by: uytvbn There shouldn't be any problems. Afaik the c++ abi hasn't been changed since gcc 3.4/4.0.

                                  I too get blank screen with Catalyst 8.6. The only driver which works with my card (4850) is 8.7 (besides 8.6 I've also tried the one bundled with the SDK), but unfortunately it doesn't seem to work with CAL. So basically I'm stuck with CPU emulation.

                                  That driver ("one bundled with the SDK") is for FireStream 9170 cards only. Our engineers are working on the updating CAL to the 8.7 drivers; very likely it will be done by the next release.

                                    • Problem building sample code
                                      jski

                                      Let me get this straight: for stream processing purposes - using the Radeon 4870 or 4850 - Catalyst 8.7 won't work?  For video purposes - using the Radeon 4870 or 4850 - Catalyst 8.6 work? Kind of a catch-22?

                                      That pretty much leaves CPU emulation (of the GPU) as the only viable development means (as stated above by "uytvbn") ... unit the next release of the SDK.  So when is the next release of the stream SDK expected - approximately?

                                      ---jski