$ sudo add-apt-repository ppa:otto-kesselgulasch/gimp
$ sudo apt-get update
$ sudo apt-get install gimp
Wednesday, 26 December 2018
How to install Gimp on Ubuntu 18.06
How to install Go on Nvidia Jetson TX2
$ uname -a
Linux tegra-ubuntu 4.4.38-tegra #1 SMP PREEMPT Thu May 17 00:15:19 PDT 2018 aarch64 aarch64 aarch64 GNU/Linux
To find the processor architecture we can check out the content of /proc/cpuinfo file:
$ cat /proc/cpuinfo
processor : 0
model name : ARMv8 Processor rev 3 (v8l)
BogoMIPS : 62.50
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 3
processor : 3
model name : ARMv8 Processor rev 3 (v8l)
BogoMIPS : 62.50
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 3
processor : 4
model name : ARMv8 Processor rev 3 (v8l)
BogoMIPS : 62.50
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 3
processor : 5
model name : ARMv8 Processor rev 3 (v8l)
BogoMIPS : 62.50
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd07
CPU revision : 3
We can see that Jetson TX2 uses version 8 of the ARM instruction set. Luckily, Go Downloads page provides archive for ARMv8 (Downloads >> Stable Versions >> Other Ports). At the time of writing the latest version was:
go1.11.4.linux-arm64.tar.gz Archive Linux ARMv8 96MB
Upon downloading the archive and verifying its checksum we can install Go by extracting it into /usr/local directory:
tar -C /usr/local -xzf go1.11.4.linux-arm64.tar.gz
Go binaries are in /usr/local/go/bin directory and to make them available from any new terminal session we have to add and persist this path to PATH environment variable.
We have to edit bash configuration:
$ sudo gedit ~/.bashrc
export PATH=(...):/usr/local/go/bin
Go installation requires defining which local directory will be Go workspace (place with all Go repositories - source code, builds and packages). I chose it to be dev/go directory in my home directory instead of the default one which is $HOME/go. For I am using non-default workspace location I have to add another environment variable in the same bash config file:
export GOPATH=$HOME/dev/go
As I've already created Go test project on my GitHub account when I was testing Go installation on Windows we can simply clone that project. Before we do it, let's make go get use SSH URL instead of HTTPS so we don't have to change it later manually (like on Windows). To achieve this we have to change global git configuration (suggested here):
$ git config --global url.git@github.com:.insteadOf https://github.com/
Let's do the clone now:
~/dev/go$ mkdir src
~/dev/go$ cd src
~/dev/go/src$ go get github.com/BojanKomazec/go-hello-world
We now have a sample go file: ~/dev/go/src/github.com/BojanKomazec/go-hello-world/hello/hello.go.
To verify that SSH URL has been used we can execute:
~/dev/go/src/github.com/BojanKomazec/go-hello-world$ git remote get-url origin
git@github.com:BojanKomazec/go-hello-world
Let's go to hello directory and build our go file:
$ go build hello.go
This creates hello executable that we can run:
$ ./hello
hello, world
This proves that our Go installation on Jetson TX2 was successful.
Saturday, 22 December 2018
Setting up Go on Windows
Installation is straightforward:
By default, installer creates or modifies the following environment variables:
In System space:
Variable (created): GOROOT
Value: C:\Go\
Description: Go installation location.
Variable (value appended): Path
Value: C:\Go\bin
Description: Go binaries location.
Variable (created): GOPATH
Value: %USERPROFILE%\go
Description: User's go workspace path.
Variable (value appended): Path
Value: %USERPROFILE%\go\bin
Description: User's Go applications' binaries location.
Go workspace:
- a directory with two subdirectories: bin and src
- src typically contains all repositories with Go projects
- bin contains built and then installed Go application binaries
- can be set at arbitrary location; I set mine to C:\dev\go (and also set User space Path to C:\dev\go\bin)
Upon installation, C:\Go\bin contains three binaries:
- go - Tool for managing Go source code
- godoc - Documentation tool; parses Go source code - including comments - and produces documentation as HTML or plain text
- gofmt - Go source code formatter; uses tabs for indentation and blanks for alignment.
Let's see what are the command line arguments of go tool:
If we already have some Go project in some Git repository (like GitHub), we can use get command to clone the given repository:
package github.com/BojanKomazec/go-hello-world: no Go files in
C:\dev\go\src\github.com\BojanKomazec\go-hello-world
Repository is cloned to C:\dev\go\src\github.com\BojanKomazec\go-hello-world directory.
Repository shall be written without starting https:// as go get would report an error:
package https:/github.com/BojanKomazec/go-hello-world: https:/github.com/BojanKomazec/go-hello-world: invalid import path: malformed import path "https:/github.com/BojanKomazec/go-hello-world": invalid char ':'
This my repository only has .gitignore and README.md files so let's add some code. First, let's create a directory named hello and in it a go file with the following content:
C:\dev\go\src\github.com\BojanKomazec\go-hello-world\hello\hello.go:
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
Building this file with:
...creates a hello.exe file in the same directory and we can run it:
hello, world
To install that build as a package, we have to run:
This deploys application binary in C:\dev\go\bin directory.
If we add, commit and then try to push hello.go file to remote repository, we'll be prompted by Git to enter our GitHub credentials as by default go get sets the https-based URL of the remote. We can verify that with:
* remote origin
Fetch URL: https://github.com/BojanKomazec/go-hello-world
Push URL: https://github.com/BojanKomazec/go-hello-world
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
We can set SSH-based URL by executing:
Let's verify it:
Enter passphrase for key '/c/Users/komazec/.ssh/id_rsa':
* remote origin
Fetch URL: git@github.com:BojanKomazec/go-hello-world.git
Push URL: git@github.com:BojanKomazec/go-hello-world.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
Let's now analyse code in the go source file above.
package main
func main() {
...
}
This line tells the Go compiler that the package should compile as an executable program. Its entry point will be function main(). If we were building a shared library, we would use package lib directive and there would not be main() function in the package.
...
fmt.Printf("hello, world\n")
import statement imports a package into other package. Here, we wanted to use function which prints a string onto standard output. Such function, Printf, is available in the fmt package which comes from the Go standard library. Go compiler looks for standard library packages on paths specified in GOROOT and your and third-party packages on path specified in GOPATH environment variables.
Project on GutHub:
https://github.com/BojanKomazec/go-hello-worldReferences:
golang.org: Go installation on WindowsUnderstanding Golang Packages
Package “main” and func “main”
Tuesday, 11 December 2018
Introduction to Yarn
- package manager
- developed by Facebook
- uses the same package.json as npm
- uses its own lock file - yarn.lock (not package-lock.json like npm)
- if installing it on Windows via installer, Node.js has to be installed first
- once installed re-launch terminal and type yarn -v to verify that it's installed successfully and see its version
- if you check out some project which uses yarn, you would typically first run yarn install to install all the dependencies of project
- each module has npm-based and yarn-based packages so can be installed via either dependency manager. E.g. babel-core:
- npm: npm install --save-dev @babel/core
- yarn: yarn add @babel/core --dev
Sunday, 9 December 2018
How to install JetPack 3.3 on Ubuntu 18.04 and flash Jetson TX2
- TensorRT 4.0 (ONNX model support)
- cuDNN v7.1.5 (improved TensorFlow model parsing)
These are the screenshots of the successful JetPack 3.3 installation on Ubuntu 18.04 and flashing Jetson TX2:
It takes couple of seconds for Component Manager to download repo information, do version checks and show the current state of packages:
At this point I actually stopped the installation as wanted to do flashing of TX a bit later. This is possible as Component Manager will pick up and show the current state of all packages upon JetPack installer re-launch:
Now I pressed ENTER to resume the installation.
Just like before, I verified that all has completed successfully on TX2 by running some of installed CUDA demo examples (e.g. rendering ocean surface - "OceanFFT").