我要评分
获取效率
正确性
完整性
易理解

API Calling Example

  1. Create a test.cpp file.
  2. Add the following code to the test.cpp file.
    #include "hmpp.h"
    #define BUFFER_SIZE_T 500
    void AddExample() {
        uint32_t *src1 = HMPPS_Malloc_32u(BUFFER_SIZE_T);
        uint32_t *src2 = HMPPS_Malloc_32u(BUFFER_SIZE_T);
        uint32_t *dst = HMPPS_Malloc_32u(BUFFER_SIZE_T);
        int32_t i, result;
    
        if (src1 == NULL || src2 == NULL || dst == NULL) {
            return;
        }
        for (i = 0; i < BUFFER_SIZE_T; ++i) {
             src1[i] = i;
             src2[i] = i + 1;
        }
        
        result = HMPPS_Add_32u(src1, src2, dst, BUFFER_SIZE_T);
        printf("result = %d \n dst = ", result);
        for (i = 0; i < BUFFER_SIZE_T; i++) {
            printf("%d ", dst[i]);
        }
        printf("\n");
    
        HMPPS_Free(src1);
        HMPPS_Free(src2);
        HMPPS_Free(dst);
    }
    int main(void){
        AddExample();
        return 0;
    }

Example of Compiling and Executing a File

  • Compile the file.
    g++ test.cpp -o test -lHMPP_fft -lHMPP_fftf -lHMPP_signal -lHMPP_core -lHMPP_image
  • Execute the file.
    ./test

Troubleshooting

Symptom:

  1. "fatal error: hmpp.h: No such file or directory"
  2. "./test: error while loading shared libraries: libHMPP_core.so.xxxx: cannot open shared object file: No such file or directory"

xxxx indicates the version number.

Procedure:

  1. Check whether header files and dynamic libraries exist in /usr/local/include/HMPP and /usr/local/lib/HMPP.
  2. Add environment variables.
    1. Open /etc/profile.
      vi /etc/profile
    2. Add the following environment variables to the file:
      export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/include/HMPP
      export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/HMPP
      if [ ! -n "$LD_LIBRARY_PATH" ]
      then
              export LD_LIBRARY_PATH=/usr/local/lib/HMPP
      else
              export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/HMPP
      fi
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. Make the configuration file take effect.
    source /etc/profile