ODROID-XU4 : TensorFlow 2.1.0 설치 (Python 3.7)

OS/Odroid 2020. 5. 3. 13:37 Posted by 파란크리스마스

출처

리눅스 정보 확인

CPU 정보 확인

$ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 3 (v7l)
BogoMIPS        : 90.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 3
 
... 생략 ...
 
Hardware        : ODROID-XU4
Revision        : 0100
Serial          : 0000000000000000

instruction set architecture (ISA)

$ uname -i
armv7l

커널에 대한 정보

$ uname -a
Linux odroid 4.14.176-174 #1 SMP PREEMPT Mon Apr 13 15:19:40 -03 2020 armv7l armv7l armv7l GNU/Linux

OS버전에 대한 정보

$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

논리 코어 수 확인

$ grep -c processor /proc/cpuinfo
8

관련 라이브러리 설치, pip3 설치 확인

$ sudo apt update
$ sudo apt install gfortran libopenblas-dev liblapack-dev libhdf5-dev
$ pip3 --version
pip 20.0.2 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

TensorFlow 2.1.0 패키지 설치

파이썬 라이브러리 설치

$ sudo pip3 install setuptools wheel
$ sudo pip3 install Cython==0.28.4
$ sudo pip3 install h5py==2.10.0

TensorFlow 2.1.0 패키지 다운로드

$ wget http://1.229.109.140:3562/tensorflow/tensorflow-2.1.0/tensorflow-2.1.0-cp37-none-linux_armv7l.whl

tensorflow 2.1.0 파이썬 패키지 설치

$ sudo pip3 install --upgrade tensorflow-2.1.0-cp37-none-linux_armv7l.whl

버전 확인

$ python3
Python 3.7.7 (default, May  3 2020, 04:25:17) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.1.0'

댓글을 달아 주세요

ODROID-XU4 : TensorFlow 2.1.0 (armv7l) - C, C++ 라이브러리 설치

OS/Odroid 2020. 5. 3. 13:31 Posted by 파란크리스마스

출처

리눅스 정보 확인

CPU 정보 확인

$ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 3 (v7l)
BogoMIPS        : 90.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 3
 
... 생략 ...
 
Hardware        : ODROID-XU4
Revision        : 0100
Serial          : 0000000000000000

instruction set architecture (ISA)

$ uname -i
armv7l

커널에 대한 정보

$ uname -a
Linux odroid 4.14.176-174 #1 SMP PREEMPT Mon Apr 13 15:19:40 -03 2020 armv7l armv7l armv7l GNU/Linux

OS버전에 대한 정보

$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

논리 코어 수 확인

$ grep -c processor /proc/cpuinfo
8

TensorFlow C, C++ 라이브러리 설치

TensorFlow 라이브러리 다운로드

$ wget http://1.229.109.140:3562/tensorflow/tensorflow-2.1.0/libtensorflow.tar.gz

TensorFlow 라이브러리 설치

$ sudo tar -C /usr/local -xzf libtensorflow.tar.gz

Linker 설정

$ sudo ldconfig

예제 hello.c

#include <stdio.h>
#include <tensorflow/c/c_api.h>

int main() {
  printf("TensorFlow C library version %s\n", TF_Version());
  return 0;
}

예제 컴파일

$ gcc hello.c -ltensorflow -o hello

예제 실행

$ ./hello
TensorFlow C library version 2.1.0


댓글을 달아 주세요

ODROID-XU4 : Python 3.7 수동 설치

OS/Odroid 2020. 5. 3. 12:03 Posted by 파란크리스마스

출처

Python 3.7 설치

기존에 설치 되어 있는 Python 삭제

$ sudo apt remove python3 python3.6 python3.6-minimal python3.6-dev python3-pip
$ sudo apt autoremove

Python을 설치하기 전에 Python을 빌드하는 데 필요한 필수 패키지를 설치

$ sudo apt update
$ sudo apt install -y --no-install-recommends libbluetooth-dev tk-dev uuid-dev wget ca-certificates gnupg2 dirmngr gcc build-essential wget zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev

Python 소스 다운로드

$ PYTHON_VERSION=3.7.7
$ wget "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"

Python 빌드

$ tar -xvf Python-$PYTHON_VERSION.tar.xz 
$ cd Python-$PYTHON_VERSION/
$ sudo ./configure --enable-loadable-sqlite-extensions \
  --enable-optimizations \
  --enable-option-checking=fatal \
  --enable-shared \
  --with-system-expat \
  --with-system-ffi \
  --without-ensurepip
$ sudo make -j 2 PROFILE_TASK='-m test.regrtest --pgo \
  test_array test_base64 test_binascii test_binhex test_binop test_bytes test_c_locale_coercion \
  test_class test_cmath test_codecs test_compile test_complex test_csv test_decimal test_dict \
  test_float test_fstring test_hashlib test_io test_iter test_json test_long test_math test_memoryview \
  test_pickle test_re test_set test_slice test_struct test_threading test_time test_traceback test_unicode'
 
 ... 생략 ...
 
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2                  _dbm                  _lzma              
_sqlite3                                                       
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd                
time                                                           

running build_scripts
copying and adjusting /home/odroid/Python-3.7.7/Tools/scripts/pydoc3 -> build/scripts-3.7
copying and adjusting /home/odroid/Python-3.7.7/Tools/scripts/idle3 -> build/scripts-3.7
copying and adjusting /home/odroid/Python-3.7.7/Tools/scripts/2to3 -> build/scripts-3.7
copying and adjusting /home/odroid/Python-3.7.7/Tools/scripts/pyvenv -> build/scripts-3.7
changing mode of build/scripts-3.7/pydoc3 from 644 to 755
changing mode of build/scripts-3.7/idle3 from 644 to 755
changing mode of build/scripts-3.7/2to3 from 644 to 755
changing mode of build/scripts-3.7/pyvenv from 644 to 755
renaming build/scripts-3.7/pydoc3 to build/scripts-3.7/pydoc3.7
renaming build/scripts-3.7/idle3 to build/scripts-3.7/idle3.7
renaming build/scripts-3.7/2to3 to build/scripts-3.7/2to3-3.7
renaming build/scripts-3.7/pyvenv to build/scripts-3.7/pyvenv-3.7
make[1]: Leaving directory '/home/odroid/Python-3.7.7'

Python 3.7 설치

$ sudo make install
$ sudo ldconfig
$ sudo find /usr/local -depth \
  \( \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
  -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \) -exec rm -rf '{}' +

pip 설치

$ cd ~  
$ wget -O get-pip.py "https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py"
$ sudo python3 get-pip.py --disable-pip-version-check --no-cache-dir "pip==20.0.2"

설치 확인

$ python3 --version
Python 3.7.7
$ pip3 --version
pip 20.0.2 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

댓글을 달아 주세요

ODROID-XU4

OS/Odroid 2020. 5. 3. 11:42 Posted by 파란크리스마스

출처

eMMC에 OS 설치

이미지 복원이 완료되면 SD 메모리를 제거하고 재부팅

$ sudo dd if=ubuntu-18.04.3-4.14-mate-odroid-xu4-20190929.img of=/dev/mmcblk0 bs=10MB
702+1 records in
702+1 records out
7022313472 bytes (7.0 GB, 6.5 GiB) copied, 167.563 s, 41.9 MB/s

WiringPi

odroid용 wiringpi 설치

$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:hardkernel/ppa
$ sudo apt update
$ sudo apt install odroid-wiringpi

odroid용 wiringpi 개발 라이브러리 설치

$ sudo apt install libwiringpi-dev libwiringpi2

GPIO 핀 확인

$ gpio readall -a
 +------+-----+----------+------+---+----+--- Model ODROID-XU3/4 ---+----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | DS | PU/PD | Physical | PU/PD | DS | V | Mode |   Name   | wPi | GPIO |
 +------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |    |       |  1 || 2  |       |    |   |      | 5V       |     |      |
 |  209 |   8 | I2C1.SDA | ALT1 | 1 |  0 |   P/U |  3 || 4  |       |    |   |      | 5V       |     |      |
 |  210 |   9 | I2C1.SCL | ALT1 | 1 |  0 |   P/U |  5 || 6  |       |    |   |      | GND(0V)  |     |      |
 |   18 |   7 | GPIO. 18 |   IN | 0 |  0 |   P/D |  7 || 8  | DSBLD | 0  | 1 | ALT1 | UART0.TX | 15  | 172  |
 |      |     |  GND(0V) |      |   |    |       |  9 || 10 | DSBLD | 0  | 0 | ALT1 | UART0.RX | 16  | 171  |
 |  174 |   0 | GPIO.174 | ALT1 | 1 |  0 | DSBLD | 11 || 12 | DSBLD | 0  | 0 | ALT1 | GPIO.173 | 1   | 173  |
 |   21 |   2 | GPIO. 21 |   IN | 0 |  0 |   P/D | 13 || 14 |       |    |   |      | GND(0V)  |     |      |
 |   22 |   3 | GPIO. 22 |   IN | 0 |  0 |   P/D | 15 || 16 | P/D   | 0  | 0 | IN   | GPIO. 19 | 4   | 19   |
 |      |     |     3.3V |      |   |    |       | 17 || 18 | P/D   | 0  | 0 | IN   | GPIO. 23 | 5   | 23   |
 |  192 |  12 |     MOSI | ALT1 | 1 |  0 |   P/U | 19 || 20 |       |    |   |      | GND(0V)  |     |      |
 |  191 |  13 |     MISO | ALT1 | 1 |  0 |   P/U | 21 || 22 | P/D   | 0  | 0 | IN   | GPIO. 24 | 6   | 24   |
 |  189 |  14 |     SCLK | ALT1 | 0 |  0 |   P/U | 23 || 24 | P/D   | 0  | 1 | OUT  | CE0      | 10  | 190  |
 |      |     |  GND(0V) |      |   |    |       | 25 || 26 | P/D   | 0  | 1 | OUT  | GPIO. 25 | 11  | 25   |
 |  187 |  30 | I2C5.SDA | ALT2 | 1 |  0 |   P/U | 27 || 28 | P/U   | 0  | 1 | ALT2 | I2C5.SCL | 31  | 188  |
 |   28 |  21 | GPIO. 28 |   IN | 0 |  0 |   P/D | 29 || 30 |       |    |   |      | GND(0V)  |     |      |
 |   30 |  22 | GPIO. 30 |   IN | 0 |  0 |   P/D | 31 || 32 | P/D   | 0  | 0 | IN   | GPIO. 29 | 26  | 29   |
 |   31 |  23 | GPIO. 31 |   IN | 0 |  0 |   P/D | 33 || 34 |       |    |   |      | GND(0V)  |     |      |
 |      |  24 | POWER ON |      |   |    |       | 35 || 36 | P/D   | 0  | 0 | IN   | GPIO. 33 | 27  | 33   |
 |      |  25 |    AIN.0 |      |   |    |       | 37 || 38 |       |    |   |      | 1V8      | 28  |      |
 |      |     |  GND(0V) |      |   |    |       | 39 || 40 |       |    |   |      | AIN.3    | 29  |      |
 +------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | DS | PU/PD | Physical | PU/PD | DS | V | Mode |   Name   | wPi | GPIO |
 +------+-----+----------+------+---+----+--- Model ODROID-XU3/4 ---+----+---+------+----------+-----+------+


댓글을 달아 주세요