mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-11-09 09:24:41 +00:00
Update Go version to 1.27 and enable SIMD compilation
This commit updates the project to use Go version 1.27 for all build and testing processes. It also introduces support for experimental SIMD code compilation, enabling it by default while ensuring a portable scalar fallback is available. Documentation has been updated to reflect the new Go version and the use of the experimental SIMD package.
This commit is contained in:
1 parent
3087c70daa
commit
db2b398dd0
5 files changed
+29
-5
No files matched your search
@@ -12,7 +12,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.27'
|
||||||
- name: Checkout obitools4 project
|
- name: Checkout obitools4 project
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.26"
|
go-version: "1.27"
|
||||||
- name: Checkout obitools4 project
|
- name: Checkout obitools4 project
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
@@ -54,7 +54,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.26"
|
go-version: "1.27"
|
||||||
|
|
||||||
- name: Extract version from tag
|
- name: Extract version from tag
|
||||||
id: get_version
|
id: get_version
|
||||||
@@ -78,7 +78,8 @@ jobs:
|
|||||||
-v "$(pwd):/src" \
|
-v "$(pwd):/src" \
|
||||||
-w /src \
|
-w /src \
|
||||||
-e VERSION="${VERSION}" \
|
-e VERSION="${VERSION}" \
|
||||||
golang:1.26-alpine \
|
-e GOEXPERIMENT=simd \
|
||||||
|
golang:1.27-alpine \
|
||||||
sh -c "apk add --no-cache gcc musl-dev zlib-dev zlib-static make && \
|
sh -c "apk add --no-cache gcc musl-dev zlib-dev zlib-static make && \
|
||||||
make LDFLAGS='-linkmode=external -extldflags=-static' obitools"
|
make LDFLAGS='-linkmode=external -extldflags=-static' obitools"
|
||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
|
|||||||
@@ -11,6 +11,14 @@ NC := \033[0m
|
|||||||
|
|
||||||
GOFLAGS=
|
GOFLAGS=
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
|
|
||||||
|
# The SIMD code (pkg/obikmer, simd package of Go >= 1.27) is only compiled with
|
||||||
|
# GOEXPERIMENT=simd; without it, a portable scalar code is used instead.
|
||||||
|
# The binaries select the vector width at run time (and fall back on an
|
||||||
|
# emulation without SIMD hardware), so they run on any CPU.
|
||||||
|
# Use `make GOEXPERIMENT= obitools` to build without SIMD.
|
||||||
|
GOEXPERIMENT?=simd
|
||||||
|
export GOEXPERIMENT
|
||||||
GOCMD=go
|
GOCMD=go
|
||||||
GOBUILD=$(GOCMD) build $(GOFLAGS) $(if $(LDFLAGS),-ldflags="$(LDFLAGS)")
|
GOBUILD=$(GOCMD) build $(GOFLAGS) $(if $(LDFLAGS),-ldflags="$(LDFLAGS)")
|
||||||
GOGENERATE=$(GOCMD) generate
|
GOGENERATE=$(GOCMD) generate
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ All the sources of the [*OBITools4*](http://metabarcoding.org/obitools4) can be
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
The *OBITools4* are developped using the [GO programming language](https://go.dev/), we stick to the latest version of the language, today the $1.21.4$. If you want to download and compile the sources yourself, you first need to install the corresponding compiler on your system. Some parts of the soft are also written in C, therefore a recent C compiler is also requested, GCC on Linux or Windows, the Developer Tools on Mac.
|
The *OBITools4* are developped using the [GO programming language](https://go.dev/), we stick to the latest version of the language, today the $1.27$. If you want to download and compile the sources yourself, you first need to install the corresponding compiler on your system. Some computations (distances between k-mers) use the experimental `simd` package of Go: the `Makefile` compiles them with `GOEXPERIMENT=simd`, and the installation script uses a Go 1.27 compiler for that reason. The resulting programs run on any processor, a portable code being used when no SIMD instruction is available. Some parts of the soft are also written in C, therefore a recent C compiler is also requested, GCC on Linux or Windows, the Developer Tools on Mac.
|
||||||
|
|
||||||
Whatever the installation you decide for, you will have to ensure that a C compiler is available on your system.
|
Whatever the installation you decide for, you will have to ensure that a C compiler is available on your system.
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
# Default values
|
# Default values
|
||||||
URL="https://go.dev/dl/"
|
URL="https://go.dev/dl/"
|
||||||
|
# Series of the Go compiler used to build OBITools4. The SIMD code relies on the
|
||||||
|
# experimental simd package of Go (GOEXPERIMENT=simd), whose API may change
|
||||||
|
# between Go versions: the build is therefore tied to the series the code was
|
||||||
|
# written for rather than to the latest release.
|
||||||
|
GO_SERIES="1.27"
|
||||||
GITHUB_REPO="https://github.com/metabarcoding/obitools4"
|
GITHUB_REPO="https://github.com/metabarcoding/obitools4"
|
||||||
INSTALL_DIR="/usr/local"
|
INSTALL_DIR="/usr/local"
|
||||||
OBITOOLS_PREFIX=""
|
OBITOOLS_PREFIX=""
|
||||||
@@ -174,10 +179,16 @@ GOFILE=$(curl -s "$URL" \
|
|||||||
| grep 'class="download"' \
|
| grep 'class="download"' \
|
||||||
| grep "\.tar\.gz" \
|
| grep "\.tar\.gz" \
|
||||||
| sed -E 's@^.*/dl/(go[1-9].+\.tar\.gz)".*$@\1@' \
|
| sed -E 's@^.*/dl/(go[1-9].+\.tar\.gz)".*$@\1@' \
|
||||||
|
| awk -v prefix="go${GO_SERIES}." 'index($0, prefix) == 1' \
|
||||||
| grep -i "$OS" \
|
| grep -i "$OS" \
|
||||||
| grep -i "$ARCH" \
|
| grep -i "$ARCH" \
|
||||||
| head -1)
|
| head -1)
|
||||||
|
|
||||||
|
if [ -z "$GOFILE" ]; then
|
||||||
|
echo "Error: no Go ${GO_SERIES} archive found for ${OS}/${ARCH} at ${URL}" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
GOURL=$(curl -s "${URL}${GOFILE}" \
|
GOURL=$(curl -s "${URL}${GOFILE}" \
|
||||||
| sed -E 's@^.*href="(.*\.tar\.gz)".*$@\1@')
|
| sed -E 's@^.*href="(.*\.tar\.gz)".*$@\1@')
|
||||||
|
|
||||||
@@ -191,8 +202,12 @@ export PATH
|
|||||||
export GOPATH="$(pwd)/gopath"
|
export GOPATH="$(pwd)/gopath"
|
||||||
export GOCACHE="$(pwd)/cache"
|
export GOCACHE="$(pwd)/cache"
|
||||||
export GOTOOLCHAIN=local
|
export GOTOOLCHAIN=local
|
||||||
|
# OBITools4 is built with the SIMD code enabled (it falls back on a portable
|
||||||
|
# code at run time if the processor has no SIMD instructions).
|
||||||
|
export GOEXPERIMENT=simd
|
||||||
|
|
||||||
echo "GOROOT=$GOROOT" 1>&2
|
echo "GOROOT=$GOROOT" 1>&2
|
||||||
|
echo "GOEXPERIMENT=$GOEXPERIMENT" 1>&2
|
||||||
echo "GOCACHE=$GOCACHE" 1>&2
|
echo "GOCACHE=$GOCACHE" 1>&2
|
||||||
mkdir -p "$GOPATH" "$GOCACHE"
|
mkdir -p "$GOPATH" "$GOCACHE"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user