GNA é um coprocessador responsável pela aceleração Gausiana e processamento de inferência integrados em alguns modelos de processadores. O GNA é similar ao coprocessador matemático dos processadores 386 da década de 90. Neste texto veremos como utilizá-lo junto ao kernel do Linux.
Sem muito BLÁ BLÁ BLÁ, para compilar a biblioteca e o respectivo exemplo, efetue o download dos fontes utilizando o comando abaixo (git clone), então teremos todo o código-fonte do repositório GitHub em nosso equipamento de trabalho.
Agora entre na pasta recém-criada novamente e use o comando cmake e make como no exemplo abaixo.
cmake . -- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cabelo/gna/gna-drv-mod.1.2.3/gna
make
Seguindo o exemplo abaixo, entre na pasta samples e use os comandos mkdir, cd e cmake para compilar o exemplo SDK.
cmake . -- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/gna/gna-drv-mod.1.2.3/gna/samples
make -- Configuring done
-- Generating done
-- Build files have been written to: /tmp/gna/gna-drv-mod.1.2.3/gna/samples
Scanning dependencies of target sample01
[ 50%] Building CXX object src/sample01/CMakeFiles/sample01.dir/sample01.cpp.o
[100%] Linking CXX executable ../../bin/sample01/sample01
[100%] Built target sample01
Agora testaremos o brinquedo?
cd bin/sample01 ./sample01 GNA Hardware Device found: 32
Este texto foi escrito por Official oneAPI Innovator Intel e o membro do openSUSE Alessandro de Oliveira Faria com base nos tutoriais Intel. Mais informações veja a página oficial:
"O próximo grande salto evolutivo da humanidade será a descoberta de que cooperar é melhor que competir... Pois colaborar atrai amigos, competir atrai inimigos!"