'프로그램 사용'에 해당되는 글 2563건

  1. 2021.06.30 gcc vectorized loop
  2. 2021.06.25 tflite typed_tensor(), tensor()
  3. 2021.06.22 gcc unsigned to signed cast
  4. 2021.06.21 git blame
  5. 2021.06.14 tflite yolov4
  6. 2021.06.10 tensorflow lite yolov4
  7. 2021.06.02 git pull rebase 설정
  8. 2021.05.26 tensorflow lite interpreter->AllocateTensors()
  9. 2021.05.21 tflite common.h
  10. 2021.05.12 distcc 만세!
프로그램 사용/gcc2021. 6. 30. 11:43

-O3 하면 자동으로 -ftree-vectorize가 추가되었다고.

아무튼 연산만 하고 출력을 안하니 사용하지 않는 코드로 해서 vadd가 안나와서 한참을 헤맸네..

 

$ g++ -O3 -mavx autovector.cpp -fopt-info-vec-all
autovector.cpp:22:22: missed: couldn't vectorize loop
autovector.cpp:25:19: missed: not vectorized: complicated access pattern.
autovector.cpp:23:21: missed: couldn't vectorize loop
autovector.cpp:25:14: missed: not vectorized: complicated access pattern.
autovector.cpp:16:23: optimized: loop vectorized using 32 byte vectors
autovector.cpp:10:5: note: vectorized 1 loops in function.
autovector.cpp:15:43: missed: statement clobbers memory: now = std::chrono::_V2::system_clock::now ();
autovector.cpp:27:77: missed: statement clobbers memory: D.189348 = std::chrono::_V2::system_clock::now ();
autovector.cpp:28:2: missed: statement clobbers memory: __assert_fail ("result[2] == ( 2.0f + 0.1335f)+( 1.50f*2.0f + 0.9383f)-(0.33f*2.0f+0.1172f)+3*(float)(noTests-1)", "autovector.cpp", 28, "int main()");
/usr/include/c++/9/ostream:570:18: missed: statement clobbers memory: std::__ostream_insert<char, std::char_traits<char> > (&cout, "CG> message -channel \"exercise results\" Time used: ", 51);
/usr/include/c++/9/ostream:221:29: missed: statement clobbers memory: _46 = std::basic_ostream<char>::_M_insert<double> (&cout, _42);
/usr/include/c++/9/ostream:570:18: missed: statement clobbers memory: std::__ostream_insert<char, std::char_traits<char> > (_46, "s, N * noTests=", 15);
autovector.cpp:29:112: missed: statement clobbers memory: _35 = std::basic_ostream<char>::operator<< (_46, 2000000000);
/usr/include/c++/9/ostream:113:13: missed: statement clobbers memory: std::endl<char, std::char_traits<char> > (_35);
/usr/include/c++/9/iostream:74:25: missed: statement clobbers memory: std::ios_base::Init::Init (&__ioinit);
/usr/include/c++/9/iostream:74:25: missed: statement clobbers memory: __cxa_atexit (__dt_comp , &__ioinit, &__dso_handle);
$ gcc -mcpu=native -march=native -Q --help=target
The following options are target specific:
  -mabi=                                aapcs-linux
  -mabort-on-noreturn                   [disabled]
  -mandroid                             [disabled]
  -mapcs                                [disabled]
  -mapcs-frame                          [disabled]
  -mapcs-reentrant                      [disabled]
  -mapcs-stack-check                    [disabled]
  -march=                               armv7ve+vfpv3-d16
  -marm                                 [enabled]
  -masm-syntax-unified                  [disabled]
  -mbe32                                [enabled]
  -mbe8                                 [disabled]
  -mbig-endian                          [disabled]
  -mbionic                              [disabled]
  -mbranch-cost=                        -1
  -mcallee-super-interworking           [disabled]
  -mcaller-super-interworking           [disabled]
  -mcmse                                [disabled]
  -mcpu=                                cortex-a7
  -mfix-cortex-m3-ldrd                  [disabled]
  -mflip-thumb                          [disabled]
  -mfloat-abi=                          hard
  -mfp16-format=                        none
  -mfpu=                                vfp
  -mglibc                               [enabled]
  -mhard-float
  -mlittle-endian                       [enabled]
  -mlong-calls                          [disabled]
  -mmusl                                [disabled]
  -mneon-for-64bits                     [disabled]
  -mpic-data-is-text-relative           [enabled]
  -mpic-register=
  -mpoke-function-name                  [disabled]
  -mprint-tune-info                     [disabled]
  -mpure-code                           [disabled]
  -mrestrict-it                         [disabled]
  -msched-prolog                        [enabled]
  -msingle-pic-base                     [disabled]
  -mslow-flash-data                     [disabled]
  -msoft-float
  -mstructure-size-boundary=            8
  -mthumb                               [disabled]
  -mthumb-interwork                     [disabled]
  -mtls-dialect=                        gnu
  -mtp=                                 cp15
  -mtpcs-frame                          [disabled]
  -mtpcs-leaf-frame                     [disabled]
  -mtune=
  -muclibc                              [disabled]
  -munaligned-access                    [enabled]
  -mvectorize-with-neon-double          [disabled]
  -mvectorize-with-neon-quad            [enabled]
  -mword-relocations                    [disabled]

  Known ARM ABIs (for use with the -mabi= option):
    aapcs aapcs-linux apcs-gnu atpcs iwmmxt

  Known __fp16 formats (for use with the -mfp16-format= option):
    alternative ieee none

  Known ARM FPUs (for use with the -mfpu= option):
    auto crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16 fpv5-d16 fpv5-sp-d16 neon neon-fp-armv8 neon-fp16 neon-vfpv3 neon-vfpv4 vfp vfp3 vfpv2 vfpv3 vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd
    vfpv3xd-fp16 vfpv4 vfpv4-d16

  Valid arguments to -mtp=:
    auto cp15 soft

  Known floating-point ABIs (for use with the -mfloat-abi= option):
    hard soft softfp

  TLS dialect to use:
    gnu gnu2


[링크 : https://www.raspberrypi.org/forums/viewtopic.php?t=155461]

[링크 : https://www.codingame.com/playgrounds/283/sse-avx-vectorization/autovectorization]

 

+

$ cat neon.c
#include <stdio.h>

void main()
{
        int a[256];
        int b[256];
        int c[256];

        int i;
        for(i = 0; i < 256; i++)
        {
                a[i] = b[i] + c[i];
        }

        printf("%d %d %d\n", a[0], b[0], c[0]);
}

 

$ gcc -O3 neon.c -mfpu=neon
$ objdump -d a.out  | grep v
   10320:       e1a01000        mov     r1, r0
   10328:       e1a0300d        mov     r3, sp
   1032c:       f4610add        vld1.64 {d16-d17}, [r1 :64]!
   10330:       f4622add        vld1.64 {d18-d19}, [r2 :64]!
   10334:       f26008e2        vadd.i32        q8, q8, q9
   10338:       f4430add        vst1.64 {d16-d17}, [r3 :64]!
   10360:       e3a0b000        mov     fp, #0
   10364:       e3a0e000        mov     lr, #0
   1036c:       e1a0200d        mov     r2, sp
   1043c:       e3a03001        mov     r3, #1
   10454:       e1a07000        mov     r7, r0
   1046c:       e1a08001        mov     r8, r1
   10470:       e1a09002        mov     r9, r2
   10480:       e3a04000        mov     r4, #0
   1048c:       e1a02009        mov     r2, r9
   10490:       e1a01008        mov     r1, r8
   10494:       e1a00007        mov     r0, r7

 

$ gcc neon.c -mfpu=neon
$ objdump -d a.out  | grep v
   10318:       e3a0b000        mov     fp, #0
   1031c:       e3a0e000        mov     lr, #0
   10324:       e1a0200d        mov     r2, sp
   103f4:       e3a03001        mov     r3, #1
   10418:       e3a03000        mov     r3, #0
   10490:       e1a00000        nop                     ; (mov r0, r0)
   104a4:       e1a07000        mov     r7, r0
   104bc:       e1a08001        mov     r8, r1
   104c0:       e1a09002        mov     r9, r2
   104d0:       e3a04000        mov     r4, #0
   104dc:       e1a02009        mov     r2, r9
   104e0:       e1a01008        mov     r1, r8
   104e4:       e1a00007        mov     r0, r7

 

-fopt-info-vec-all 추가. -all 때문인지 어마어마하게 나오네

-fopt-info-vec 으로만 하니 깔끔하게 vectorized 라고 뜬다.

$ gcc neon.c -mfpu=neon -fopt-info-vec -O3
neon.c:10:2: note: loop vectorized

'프로그램 사용 > gcc' 카테고리의 다른 글

구조체 타입과 변수명은 구분된다?  (0) 2021.11.18
gcc unsigned to signed upcast 테스트  (0) 2021.07.08
gcc unsigned to signed cast  (0) 2021.06.22
gcc %p (nil)  (0) 2021.05.07
gcc -D 옵션 인자를 printf로 출력하기  (0) 2021.04.08
Posted by 구차니

정상적으로 작동하지 않아서 코드를 보는데, typed_tensor()라는 부분을 발견.

 

typed_tensor (int tensor_index)
T *
Perform a checked cast to the appropriate tensor type (mutable pointer version).

[링크 : https://www.tensorflow.org/lite/api_docs/cc/class/tflite/interpreter#classtflite_1_1_interpreter_1a314...]

 

tensor (int tensor_index)
TfLiteTensor *
Get a mutable tensor data structure.

[링크 : https://www.tensorflow.org/lite/api_docs/cc/class/tflite/interpreter#classtflite_1_1_interpreter_1ac1d...]

[링크 : https://www.tensorflow.org/lite/api_docs/cc/class/tflite/interpreter]

 

+

[링크 : https://github.com/tensorflow/tensorflow/.../tensorflow/lite/examples/label_image/label_image.cc]

[링크 : https://github.com/tensorflow/tensorflow/.../tensorflow/lite/examples/label_image/bitmap_helpers_impl.h]

 

+

2021.06.28

이거랑 상관없었음

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tensorflow lite on rpi4 64bit  (0) 2021.06.30
tensorflow delegate  (0) 2021.06.30
tflite yolov4  (0) 2021.06.14
tensorflow lite yolov4  (0) 2021.06.10
tensorflow lite interpreter->AllocateTensors()  (0) 2021.05.26
Posted by 구차니
프로그램 사용/gcc2021. 6. 22. 19:15

예전에는 문제없이 unsigned char에 대한 int 형으로의 캐스팅이 문제없이 되었던 것 같은데 안되서

C99나 C11의 영향인지 조금 더 찾아보는 중.

 

[링크 : https://gcc.gnu.org/onlinedocs/gcc/Characters-implementation.html#Characters-implementationl]

[링크 : https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html]

[링크 : https://gcc.gnu.org/wiki/NewWconversion]

 

'프로그램 사용 > gcc' 카테고리의 다른 글

gcc unsigned to signed upcast 테스트  (0) 2021.07.08
gcc vectorized loop  (0) 2021.06.30
gcc %p (nil)  (0) 2021.05.07
gcc -D 옵션 인자를 printf로 출력하기  (0) 2021.04.08
Auto-vectorization in GCC  (0) 2021.03.25
Posted by 구차니

svn 처럼 git 에도 소스라인 단위로 누가 커밋한 건지 추적하는 기능이 없나 봤는데 있다!

 

$ git blame
사용법: git blame [<옵션>] [<리비전-옵션>] [<리비전>] [--] <파일>

    <리비전-옵션>은 git-rev-list(1)에 설명되어 있습니다

    --incremental         블레임 항목을 찾자마자 점진적으로 표시합니다
    -b                    가장자리 커밋에 대해 빈 SHA-1을 표시합니다 (기본값: 꺼짐)
    --root                최상위 커밋을 가장자리 커밋으로 취급하지 않습니다 (기본값: 꺼짐)
    --show-stats          작업 비용 통계를 표시합니다
    --progress            강제로 진행 상황을 표시합니다
    --score-debug         블레임 항목에 대해 출력 점수를 표시합니다
    -f, --show-name       원래 파일 이름 표시 (기본값: 자동)
    -n, --show-number     원래 줄 번호 표시 (기본값: 하지 않음)
    -p, --porcelain       컴퓨터 처리용으로 설계된 형식으로 표시합니다
    --line-porcelain      줄마다 커밋 정보가 표시되는 사용자용 형식으로 표시합니다
    -c                    git-annotate와 동일한 형식을 사용합니다 (기본값: 꺼짐)
    -t                    내부 형식으로 시각을 표시합니다 (기본값: 꺼짐)
    -l                    길게 커밋 SHA1을 표시합니다 (기본값: 꺼짐)
    -s                    작성자 이름과 시각을 표시하지 않습니다 (기본값: 꺼짐)
    -e, --show-email      작성자 이름 대신에 전자메일을 표시합니다 (기본값: 꺼짐)
    -w                    공백 문자 차이점을 무시합니다
    --indent-heuristic    diff를 향상하는데 실험적인 휴리스틱을 사용합니다
    --minimal             더 일치하는 항목을 찾는데 더 시간을 소모합니다
    -S <파일>             git-rev-list를 호출하는 대신 <파일>에서 리비전을 사용합니다
    --contents <파일>     <파일>의 내용을 최종 이미지로 사용합니다
    -C[<점수>]            파일 내부와 파일 사이의 복사된 줄을 찾습니다
    -M[<점수>]            파일 내부와 파일 사이의 옮겨진 줄을 찾습니다
    -L <n,m>              n,m줄 (1번 줄부터 시작) 사이의 범위만 처리
    --abbrev[=<n>]        SHA-1 표시에 <n>개의 숫자를 사용합니다

[링크 : https://git-scm.com/docs/git-blame/2.31.0]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git diff --staged  (0) 2022.09.05
git reset 서버 commit  (0) 2021.09.14
git pull rebase 설정  (0) 2021.06.02
git log --stat  (0) 2021.05.10
git stash  (0) 2021.05.09
Posted by 구차니

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tensorflow delegate  (0) 2021.06.30
tflite typed_tensor(), tensor()  (0) 2021.06.25
tensorflow lite yolov4  (0) 2021.06.10
tensorflow lite interpreter->AllocateTensors()  (0) 2021.05.26
tflite common.h  (0) 2021.05.21
Posted by 구차니

output 텐서의 차원에 대한 정보는 세개 변수에 저장된다.

TfLiteType type;
TfLiteIntArray* dims;
size_t bytes;

 

type은 개별 엘리먼트의 출력 포맷(float라던가 uint8 이라던가)의 변수 크기를 저장하고

dims.size 에는 몇 차원 텐서인지

dims.data[] 에는 차원별 갯수를 저장한다.

dims.size = 4

dims.data[] = [1 7 7 18] 식으로 저장되며

float32형이기에

1*7*7*18*sizeof(float) = 3528 byte로

해당 내용은 bytes에 저장된다.

 

TfLitePtrUnion data;

그리고 그 용량의 데이터는 data에 저장되어 접근을 하면 되는데..

차원을 어떻게 접근해야 하려나.. -_-

 

대충 label_image.cc 예제에서 이런 식으로 출력하면 okay

    printf("dims size[%d]\n",output_dims->size);
    for(int idx = 0; idx < output_dims->size; idx++)
    {
            printf("%d\t",output_dims->data[idx]);
    }

    printf("tensor pos bytes [%d]\n",interpreter->tensor(interpreter->outputs()[0])->bytes);
    printf("tensor per bytes [%d]\n",interpreter->tensor(interpreter->outputs()[1])->bytes);

 

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tflite typed_tensor(), tensor()  (0) 2021.06.25
tflite yolov4  (0) 2021.06.14
tensorflow lite interpreter->AllocateTensors()  (0) 2021.05.26
tflite common.h  (0) 2021.05.21
imx6q neon tensorlow lite  (0) 2021.05.10
Posted by 구차니

 

 

$ git config --global branch.autosetuprebase always
$ git config branch.{BRANCH-NAME}.rebase true

[링크 : http://theeye.pe.kr/archives/1980]

 

비슷한 결과를 만드는 다른 방식으로, C3 에서 변경된 사항을 Patch로 만들고 이를 다시 C4 에 적용시키는 방법이 있다. Git에서는 이런 방식을 Rebase 라고 한다. rebase 명령으로 한 브랜치에서 변경된 사항을 다른 브랜치에 적용할 수 있다.

[링크 : https://git-scm.com/book/ko/v2/Git-브랜치-Rebase-하기]

[링크 : https://jusths.tistory.com/60]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git reset 서버 commit  (0) 2021.09.14
git blame  (0) 2021.06.21
git log --stat  (0) 2021.05.10
git stash  (0) 2021.05.09
git 저장소 합치기 해보았으나..  (0) 2021.04.07
Posted by 구차니

segmentation fault가 떠서 어디서 죽나 찾는데 꽤나 고생했네 -_-

(빌드가 느리면 역시 스트레스..)

 

그런데 도무지 allocateTensors() 라는 함수가 어떤 역활을 하는지 모르겠네..

한번 할당하고 또 할당하면 오류나는 느낌..

 

  // Allocate memory for the model's input `Tensor`s.
  try interpreter.allocateTensors()

[링크 : https://www.tensorflow.org/lite/guide/inference]

[링크 : https://www.tensorflow.org/lite/api_docs/cc/class/tflite/interpreter#allocatetensors]

 

여기 소스를 많이 참고했는데.. tensorflow의 label_image쪽이랑은 또 많이 달라서

어느 가이드를 따라가야 하나 고민..

[링크 : https://github.com/Qengineering/TensorFlow_Lite_SSD_RPi_64-bits/blob/master/MobileNetV1.cpp]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tflite yolov4  (0) 2021.06.14
tensorflow lite yolov4  (0) 2021.06.10
tflite common.h  (0) 2021.05.21
imx6q neon tensorlow lite  (0) 2021.05.10
tflite type  (0) 2021.05.01
Posted by 구차니

label_image 예제를 보면 get_top_n 에서

(prediction[i] + 128) / 256.0 나 prediction[i] / 255.0 

같은 quantization 범위에 맞춘 무언가가 보이는데 

TfLiteQuantizationParams.scale 와 TfLiteQuantizationParams.zero_point을 이용하면 자동화 가능할 느낌.

template <class T>
void get_top_n(T* prediction, int prediction_size, size_t num_results,
               float threshold, std::vector<std::pair<float, int>>* top_results,
               TfLiteType input_type) {
  // Will contain top N results in ascending order.
  std::priority_queue<std::pair<float, int>, std::vector<std::pair<float, int>>,
                      std::greater<std::pair<float, int>>>
      top_result_pq;

  const long count = prediction_size;  // NOLINT(runtime/int)
  float value = 0.0;

  for (int i = 0; i < count; ++i) {
    switch (input_type) {
      case kTfLiteFloat32:
        value = prediction[i];
        break;
      case kTfLiteInt8:
        value = (prediction[i] + 128) / 256.0;
        break;
      case kTfLiteUInt8:
        value = prediction[i] / 255.0;
        break;
      default:
        break;
    }
    // Only add it if it beats the threshold and has a chance at being in
    // the top N.
    if (value < threshold) {
      continue;
    }

    top_result_pq.push(std::pair<float, int>(value, i));

    // If at capacity, kick the smallest value out.
    if (top_result_pq.size() > num_results) {
      top_result_pq.pop();
    }
  }

  // Copy to output vector and reverse into descending order.
  while (!top_result_pq.empty()) {
    top_results->push_back(top_result_pq.top());
    top_result_pq.pop();
  }
  std::reverse(top_results->begin(), top_results->end());
}

 

netron 에서 보면 quantization 범위가 나오는데, 어딘가 저장하고는 있는 듯 해서 검색 중

// SupportedQuantizationTypes.
typedef enum TfLiteQuantizationType {
  // No quantization.
  kTfLiteNoQuantization = 0,
  // Affine quantization (with support for per-channel quantization).
  // Corresponds to TfLiteAffineQuantization.
  kTfLiteAffineQuantization = 1,
} TfLiteQuantizationType;

// Structure specifying the quantization used by the tensor, if-any.
typedef struct TfLiteQuantization {
  // The type of quantization held by params.
  TfLiteQuantizationType type;
  // Holds a reference to one of the quantization param structures specified
  // below.
  void* params;
} TfLiteQuantization;

// Legacy. Will be deprecated in favor of TfLiteAffineQuantization.
// If per-layer quantization is specified this field will still be populated in
// addition to TfLiteAffineQuantization.
// Parameters for asymmetric quantization. Quantized values can be converted
// back to float using:
//     real_value = scale * (quantized_value - zero_point)
typedef struct TfLiteQuantizationParams {
  float scale;
  int32_t zero_point;
} TfLiteQuantizationParams;

// Parameters for asymmetric quantization across a dimension (i.e per output
// channel quantization).
// quantized_dimension specifies which dimension the scales and zero_points
// correspond to.
// For a particular value in quantized_dimension, quantized values can be
// converted back to float using:
//     real_value = scale * (quantized_value - zero_point)
typedef struct TfLiteAffineQuantization {
  TfLiteFloatArray* scale;
  TfLiteIntArray* zero_point;
  int32_t quantized_dimension;
} TfLiteAffineQuantization;

typedef struct TfLiteTensor {
  TfLiteType type;
  TfLitePtrUnion data;
  TfLiteIntArray* dims;
  TfLiteQuantizationParams params;
  TfLiteAllocationType allocation_type;
  size_t bytes;
  const void* allocation;
  const char* name;
  struct TfLiteDelegate* delegate;
  TfLiteBufferHandle buffer_handle;
  bool data_is_stale;
  bool is_variable;
  TfLiteQuantization quantization;
  TfLiteSparsity* sparsity;
  const TfLiteIntArray* dims_signature;
} TfLiteTensor;

 

+

2021.05.26

typedef struct TfLiteIntArray {
  int size;
// gcc 6.1+ have a bug where flexible members aren't properly handled
// https://github.com/google/re2/commit/b94b7cd42e9f02673cd748c1ac1d16db4052514c
#if (!defined(__clang__) && defined(__GNUC__) && __GNUC__ == 6 && \
     __GNUC_MINOR__ >= 1) ||                                      \
    defined(HEXAGON) || (__clang_major__ == 7 && __clang_minor__ == 1)
  int data[0];
#else
  int data[];
#endif
} TfLiteIntArray;

// Fixed size list of floats. Used for per-channel quantization.
typedef struct TfLiteFloatArray {
  int size;
// gcc 6.1+ have a bug where flexible members aren't properly handled
// https://github.com/google/re2/commit/b94b7cd42e9f02673cd748c1ac1d16db4052514c
// This also applies to the toolchain used for Qualcomm Hexagon DSPs.
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ == 6 && \
    __GNUC_MINOR__ >= 1
  float data[0];
#else
  float data[];
#endif
} TfLiteFloatArray;

 

class Interpreter {
  /// Invoke the interpreter (run the whole graph in dependency order).
  ///
  /// NOTE: It is possible that the interpreter is not in a ready state
  /// to evaluate (i.e. if a ResizeTensor() has been performed without an
  /// AllocateTensors().
  /// Returns status of success or failure.
  TfLiteStatus Invoke();

  /// WARNING: Experimental interface, subject to change
  Subgraph& primary_subgraph() {
    return *subgraphs_.front();  /// Safe as subgraphs_ always has 1 entry.
  }
  
  /// Read only access to list of inputs.
  const std::vector<int>& inputs() const { return primary_subgraph().inputs(); }
  
  /// Read only access to list of outputs.
  const std::vector<int>& outputs() const {
    return primary_subgraph().outputs();
  }
  
  // Subgraphs
  std::vector<std::unique_ptr<Subgraph>> subgraphs_;
};

[링크 : https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/interpreter.h]

 

class Subgraph {
  // Array of indices representing the tensors that are inputs to the
  // interpreter.
  std::vector<int> inputs_;

  // Array of indices representing the tensors that are outputs to the
  // interpreter.
  std::vector<int> outputs_;
  
  // Read only access to list of inputs.
  std::vector<int>& inputs() { return inputs_; }

  // Read only access to list of inputs.
  const std::vector<int>& inputs() const { return inputs_; }

  // Read only access to list of outputs.
  std::vector<int>& outputs() { return outputs_; }

  // Read only access to list of outputs.
  const std::vector<int>& outputs() const { return outputs_; }
};

[링크 : https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/core/subgraph.h]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tensorflow lite yolov4  (0) 2021.06.10
tensorflow lite interpreter->AllocateTensors()  (0) 2021.05.26
imx6q neon tensorlow lite  (0) 2021.05.10
tflite type  (0) 2021.05.01
tflite example  (0) 2021.04.19
Posted by 구차니

라즈베리 파이 3b+ 에 lxde 올리지 않고 콘솔로만 해서 메모리 최대한 확보하고 쓰는 중인데

비디오 메모리 64MB 정도 먹혔는지 가용 메모리가 706MiB 정도.

$ free -h
              total        used        free      shared  buff/cache   available
Mem:          924Mi        50Mi       706Mi       4.0Mi       166Mi       817Mi
Swap:          99Mi       9.0Mi        90Mi

 

그런 이유로 텐서플로우 빌드시 rpi 메모리가 2G 넘지 않으면 코어 하나만 쓰게 되어있다.

FREE_MEM="$(free -m | awk '/^Mem/ {print $2}')"
# Use "-j 4" only memory is larger than 2GB
if [[ "FREE_MEM" -gt "2000" ]]; then
  NO_JOB=4
else
  NO_JOB=1
fi

 

그래서 distcc 통해 개별 노드에서 2개씩, 총 3개 노드/ 6 core 쓰도록 하니

35~40분 정도 걸리던 빌드가 8분 40초 만에 끝내준다.

real    8m39.261s
user    2m47.210s
sys     0m51.071s

 

개별 노드에서 병렬시 2개 까지만 허락하도록 해놔야지 안그러면

메모리 부족으로 스왑한다고 io 폭주해서 라즈베리가 먹통이 된다.

/etc/default/distcc

#
# You can specify a maximum number of jobs, the server will accept concurrently
#
# JOBS=""

JOBS="2"

'프로그램 사용 > distcc & ccache' 카테고리의 다른 글

rpi distcc with ccache 실패 ㅠㅠ  (0) 2021.04.30
rpi distcc 성공인데 실패  (0) 2021.04.28
distcc hosts 파일과 순서  (0) 2016.10.19
distcc-pump 시도..  (0) 2016.10.18
distcc 를 DHCP 에서.. 2?  (0) 2016.10.18
Posted by 구차니