Commit 53987d19 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Merge branch 'kvamme62/misc' into 'master'

Sync with the internal SLB repository.

See merge request !114
parents d8165b6c 3e2b54c1
Pipeline #101024 passed with stages
in 19 minutes and 30 seconds
......@@ -182,6 +182,7 @@ clobber:
$(RM) pure.tar native.tar wrap.tar deploy.tgz OpenZGY.zip
$(RM) build/deploy/testscripts.tar
@echo Checking that ./build is empty after clobbering
test ! -d build || find build -type f -print
test ! -d build || test `find build -type f -print | wc -l` -eq 0
$(TESTRUNDIR):
......
......@@ -48,6 +48,11 @@ steps:
docker --version
docker system info | grep -i version
docker system df
docker rmi ${TAG}:{manual,sdbuild,ozbuild,oztests}-old || true
docker tag ${TAG}:manual ${TAG}:manual-old || true
docker tag ${TAG}:sdbuild ${TAG}:sdbuild-old || true
docker tag ${TAG}:ozbuild ${TAG}:ozbuild-old || true
docker tag ${TAG}:oztests ${TAG}:oztests-old || true
rm -f oztests.iid
mkdir -p seismic-store-cpp-lib seismic-dms-sdapi private
docker build --pull -f ${DOCKERFILE} --target sdapi-manual --build-arg AZURE_BUILDID=$(Build.BuildId) -t ${TAG}:manual .
......@@ -55,10 +60,6 @@ steps:
docker build -f ${DOCKERFILE} --target openzgy-build --build-arg AZURE_BUILDID=$(Build.BuildId) -t ${TAG}:ozbuild .
docker build -f ${DOCKERFILE} --target openzgy-testenv --build-arg AZURE_BUILDID=$(Build.BuildId) -t ${TAG}:oztests --iidfile oztests.iid .
docker rmi ${TAG}:{manual,sdbuild,ozbuild,oztests}-old || true
docker tag ${TAG}:manual ${TAG}:manual-old || true
docker tag ${TAG}:sdbuild ${TAG}:sdbuild-old || true
docker tag ${TAG}:ozbuild ${TAG}:ozbuild-old || true
docker tag ${TAG}:oztests ${TAG}:oztests-old || true
rmdir --ignore-fail-on-non-empty seismic-store-cpp-lib seismic-dms-sdapi private || true
id=$(docker create $(cat oztests.iid))
docker cp ${id}:/home/me/oz/build/deploy - | gzip -9 > deploy.tgz
......
......@@ -11,17 +11,22 @@ set -e
cd $(dirname $0)/../..
# Selectively enable or disable tests depending on what options were included.
source build/deploy/config.sh
# If OpenZGY was built without Seismic Store support then these tests
# do not apply. Unfortunately I cannot access native/src/Make.packages,
# so this check is not very elegant. The main problem is to figure out
# whether Seismic Store was actually meant to be present.
# Updated: using build/deploy/config.sh is cleaner. I'll keep the old
# logic as well.
SDSDKS=$(/bin/ls seismic-service-bin/*/sdapi* 2>/dev/null || /bin/true)
WHEELS=$(/bin/ls build/deploy/sdglue/*/SdGlue-*.whl 2>/dev/null || /bin/true)
if [ x"${WHEELS}" = "x" -a ! -r build/deploy/sdglue/requirements.txt ]
then
# Test will not succeed. Try to understand why.
if [ x"${SDSDKS}" = "x" ]
if [ x"${SDSDKS}" = "x" -a x"${HAVE_SD}" = "x" ]
then
# No SDAPI SDK found for any platform. It is safe to assume
# that the user did not expect to build with cloud support.
......@@ -35,6 +40,8 @@ then
echo >&2 "OpenZGY has problems with Seismic Store support."
echo >&2 "If you meant to build without Seismic Store then"
echo >&2 "please rename or delete seismic-service-bin."
echo >&2 "SDSDKS = \"${SDSDKS}\""
echo >&2 "HAVE_SD = \"${HAVE_SD}\""
exit 1
fi
else
......
......@@ -35,11 +35,15 @@
$(if $(strip $(BUILDROOT)),,$(error BUILDROOT was not set))
CONFIG_FILE = $(BUILDROOT)/build/deploy/config.sh
SD_BUILDDIR = $(BUILDROOT)/build/temp/Seismic-Drive
SD_ZIPFILE = $(BUILDROOT)/seismic-service-bin/$(PLATFORM)/sdapi_linux64_osdu.tar.gz
SD_SENTINEL = $(SD_BUILDDIR)/sdapi.timestamp
HAVE_SD := $(if $(wildcard $(SD_ZIPFILE)),yes,)
HAVE_INTERNAL_SD := $(if $(and $(HAVE_SD),$(findstring linux64_local,$(SD_ZIPFILE))),yes,)
SD_CXXFLAGS = $(if $(HAVE_SD),-I$(SD_BUILDDIR)/include -DHAVE_SD)
SD_CXXFLAGS += $(if $(HAVE_INTERNAL_SD), -DHAVE_INTERNAL_SD)
SD_LIBRARY = $(if $(HAVE_SD),$(SD_BUILDDIR)/lib/linux64/libsdapi.so)
ZFP_BUILDDIR = $(BUILDROOT)/build/temp/zfpbuildnative
......@@ -51,11 +55,22 @@ ZFP_LIBRARY = $(if $(HAVE_ZFP),$(ZFP_BUILDDIR)/build/lib64/libzfp.so)
.PHONY: packages packages-clean
packages: $(SD_SENTINEL) $(ZFP_SENTINEL)
packages: $(SD_SENTINEL) $(ZFP_SENTINEL) $(CONFIG_FILE)
@/bin/true
packages-clean:
$(RM) -rf $(SD_BUILDDIR) $(ZFP_BUILDDIR)
$(RM) $(CONFIG_FILE)
$(CONFIG_FILE): ALWAYS
mkdir -p $(@D)
echo > $@
echo >> $@ 'HAVE_SD="$(HAVE_SD)"'
echo >> $@ 'HAVE_ZFP="$(HAVE_ZFP)"'
echo >> $@ 'HAVE_INTERNAL_SD="$(HAVE_INTERNAL_SD)"'
.PHONY: ALWAYS
ALWAYS:
# Unzip the SDAPI tarball into build/Seismic-Drive which will be used
# during building, both for headers and for the binary. Note: Build
......
# Copyright 2017-2021, Schlumberger
# Copyright 2017-2022, Schlumberger
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -81,7 +81,7 @@ info:
@echo OBJ = $(MAIN_OBJ) -- $(TEST_OBJ) -- $(TOOL_OBJ)
@echo ALL_OBJ_DIR = $(ALL_OBJ_DIR)
build: $(LIBDSO) $(BIN_DIR)/test_all headers tools
build: $(CONFIG_FILE) $(LIBDSO) $(BIN_DIR)/test_all headers tools
headers: $(addprefix $(INC_DIR)/,$(PUBLISHED_INC))
......@@ -106,7 +106,7 @@ valgrind: $(BIN_DIR)/test_all data | $(TESTRUNDIR)
@echo
-valgrind --log-file=$(LOG_DIR)/valgrind.txt --tool=memcheck --num-callers=12 --leak-check=full --suppressions=test/suppressions.txt $(BIN_DIR)/test_all --color=never --no-exec
tools: $(BIN_DIR)/zgycopyc $(BIN_DIR)/zgydumpc $(BIN_DIR)/bulk_inspector $(BIN_DIR)/meta_inspector
tools: $(BIN_DIR)/zgycopyc $(BIN_DIR)/zgydumpc $(BIN_DIR)/zgydiffc $(BIN_DIR)/bulk_inspector $(BIN_DIR)/meta_inspector $(BIN_DIR)/example
@echo Tools have been built.
nm: $(LIBDSO)
......@@ -229,6 +229,10 @@ $(BIN_DIR)/zgydumpc: $(OBJ_DIR)/tools/zgydumpc.o $(LIBDSO)
$(CXX) -o $@ $(CXXFLAGS) $(ORIGIN) $^
@echo Tool $(@F) has been built.
$(BIN_DIR)/zgydiffc: $(OBJ_DIR)/tools/zgydiffc.o $(LIBDSO)
$(CXX) -o $@ $(CXXFLAGS) $(ORIGIN) $^
@echo Tool $(@F) has been built.
$(BIN_DIR)/bulk_inspector: $(OBJ_DIR)/tools/bulk_inspector.o $(LIBDSO)
$(CXX) -o $@ $(CXXFLAGS) $(ORIGIN) $^
@echo Tool $(@F) has been built.
......
......@@ -28,6 +28,9 @@
#include <algorithm>
#include <cmath>
#define USE_NEW_LATTICE 0 // TODO-Low enable this after more testing.
#define TEST_NEW_LATTICE 0
namespace InternalZGY {
#if 0
}
......@@ -200,7 +203,7 @@ pod2bytes(const T& pod)
static std::tuple<std::array<std::array<double,2>,4>,
std::array<std::array<double,2>,4>,
std::array<std::array<double,2>,4>>
calcOrderedCorners(const std::array<float,3>& orig,
calcOrderedCornersOld(const std::array<float,3>& orig,
const std::array<float,3>& inc,
const std::array<std::int64_t,3>& size,
const std::array<float,4>& gpiline,
......@@ -227,7 +230,7 @@ calcOrderedCorners(const std::array<float,3>& orig,
ocp.world_coords());
}
#if 0 // TODO-Low: enable this.
#if USE_NEW_LATTICE
/**
* Alternative implementation. The generalTransform() method it calls
* is a lot simpler than OrderedCornerPoints but I worry about testing.
......@@ -268,6 +271,75 @@ calcOrderedCornersNew(const std::array<float,3>& orig,
}
#endif
static std::tuple<std::array<std::array<double,2>,4>,
std::array<std::array<double,2>,4>,
std::array<std::array<double,2>,4>>
calcOrderedCorners(const std::array<float,3>& orig,
const std::array<float,3>& inc,
const std::array<std::int64_t,3>& size,
const std::array<float,4>& gpiline,
const std::array<float,4>& gpxline,
const std::array<double,4>& gpx,
const std::array<double,4>& gpy)
{
auto oldresult = calcOrderedCornersOld(orig, inc, size, gpiline, gpxline, gpx, gpy);
#if USE_NEW_LATTICE && TEST_NEW_LATTICE
auto newresult = calcOrderedCornersNew(orig, inc, size, gpiline, gpxline, gpx, gpy);
static auto fmt = [](const std::array<std::array<double,2>,4>& c) {
std::stringstream ss;
ss << "(" << c[0][0] << ", " << c[0][1] << "), "
<< "(" << c[1][0] << ", " << c[1][1] << "), "
<< "(" << c[2][0] << ", " << c[2][1] << "), "
<< "(" << c[3][0] << ", " << c[3][1] << ")";
return ss.str();
};
std::array<std::array<double,2>,4> old_index, old_annot, old_world;
std::array<std::array<double,2>,4> new_index, new_annot, new_world;
std::tie(old_index, old_annot, old_world) = oldresult;
std::tie(new_index, new_annot, new_world) = newresult;
std::cout << "calcOrderedCorners() debugging\n"
<< " Lattice as stored on file\n"
<< " il beg = " << orig[0]
<< " step = " << inc[0]
<< " size = " << size[0] << "\n"
<< " xl beg = " << orig[1]
<< " step = " << inc[1]
<< " size = " << size[1] << "\n"
<< " point 0 annot = (" << gpiline[0] << ", " << gpxline[0]
<< "), world = (" << gpx[0] << ", " << gpy[0] << ")\n"
<< " point 1 annot = (" << gpiline[1] << ", " << gpxline[1]
<< "), world = (" << gpx[1] << ", " << gpy[1] << ")\n"
<< " point 2 annot = (" << gpiline[2] << ", " << gpxline[2]
<< "), world = (" << gpx[2] << ", " << gpy[2] << ")\n"
<< " Old converter:\n"
<< " index " << fmt(old_index) << "\n"
<< " annot " << fmt(old_annot) << "\n"
<< " world " << fmt(old_world) << "\n"
<< " New converer:\n"
<< " index " << fmt(new_index) << "\n"
<< " annot " << fmt(new_annot) << "\n"
<< " world " << fmt(new_world) << "\n"
<< std::flush;
// The test might not be appropriate when testing corner cases.
// E.g. for missing annotation but existing world coords
// the new code might be doing a better job.
for (int ii=0; ii<4; ++ii)
for (int jj=0; jj<2; ++jj)
if (std::abs(old_index[ii][jj] - new_index[ii][jj]) > 0.0)
throw new std::runtime_error("calcOrderedCorners mismatch in index");
for (int ii=0; ii<4; ++ii)
for (int jj=0; jj<2; ++jj)
if (std::abs(old_annot[ii][jj] - new_annot[ii][jj]) > 0.001)
throw new std::runtime_error("calcOrderedCorners mismatch in annot");
for (int ii=0; ii<4; ++ii)
for (int jj=0; jj<2; ++jj)
if (std::abs(old_world[ii][jj] - new_world[ii][jj]) > 0.1)
throw new std::runtime_error("calcOrderedCorners mismatch in index");
#endif
return oldresult;
}
/**
* Sanity check. If the codingrange for an int cube is bad, silently
* use a range that causes no conversion between storage and float.
......
......@@ -69,7 +69,7 @@ namespace InternalZGY {
* (s,t) to compute q in the other system.
*
*********************************************************************/
bool generalTransform(
OPENZGY_API bool generalTransform(
double AX0, double AY0,
double AX1, double AY1,
double AX2, double AY2,
......
......@@ -13,19 +13,21 @@
// limitations under the License.
#pragma once
#include "../declspec.h"
#include <cstdint>
#include <cstddef>
/**
* \file transform.h
* \brief General coordinate conversion based on 3 control points.
* INTERNAL, but exported for use in vds2zgy.
*/
namespace InternalZGY {
/**
* \brief General coordinate conversion based on 3 control points.
*/
extern bool generalTransform(
OPENZGY_API extern bool generalTransform(
double AX0, double AY0,
double AX1, double AY1,
double AX2, double AY2,
......
......@@ -19,6 +19,11 @@ cd $(dirname $0)/../..
# Local tricks in my environment to get a valid SAuth token.
eval $(test ! -x private/grabtoken.sh || private/grabtoken.sh -v)
# Selectively enable or disable tests depending on what options were included.
# Note that some tests handle this themselves. E.g. test_all.
# TODO, it would be cleaner to always use the config.sh.
source build/deploy/config.sh
# I'd rather not depend on scripts/getdistro and g++ -dumpfullversion here,
# because the tests ought to be runnable even without the compiler present.
# So, just look at the deploy folder and use whatever architecture is there.
......@@ -28,11 +33,18 @@ if [ "x$MYPLATFORM" = "x" ]; then
MYPLATFORM=$(basename $(dirname build/deploy/native/*/test_all) | awk '{print $1}')
fi
ALL_TESTDATA="
Empty-v1.zgy
Empty-v3.zgy
EmptyOldFile.zgy
Fancy-int8.zgy
"
mkdir -p build/testdata
bzip2 -dkc testdata/Empty-v1.zgy.bz2 > build/testdata/Empty-v1.zgy
bzip2 -dkc testdata/Empty-v3.zgy.bz2 > build/testdata/Empty-v3.zgy
bzip2 -dkc testdata/Fancy-int8.zgy.bz2 > build/testdata/Fancy-int8.zgy
bzip2 -dkc testdata/EmptyOldFile.zgy.bz2 > build/testdata/EmptyOldFile.zgy
for file in $ALL_TESTDATA
do
bzip2 -dkc testdata/${file}.bz2 > build/testdata/${file}
done
/bin/rm -rf build/run
/bin/mkdir -p build/run
......@@ -51,6 +63,7 @@ if [ $# -eq 1 -a "x$1" = "xvalgrind" ]
then
set +e
mkdir -p ../../build/deploy/native
echo "NOT RUN" > ../../build/deploy/native/valgrind.txt
echo "Testing OpenZGY/C++ for ${MYPLATFORM}"
echo "valgrind ${TESTAPP} --color=never --no-exec ${TESTLIST}"
set -x
......
......@@ -223,8 +223,8 @@ compare(const std::string& file1, const std::string& file2,
int main(int argc, const char **argv)
{
try {
if (argc < 3 || argc > 4)
throw std::runtime_error("Usage: zgydiff file1 file2 [epsilon]");
if (argc < 3)
throw std::runtime_error("Usage: zgydiff file1 file2 [epsilon] [-v|-q]");
double epsilon_value{-1};
double epsilon_index{-1};
double epsilon_annot{-1};
......@@ -242,6 +242,14 @@ int main(int argc, const char **argv)
epsilon_annot = 0.01;
epsilon_world = 0.1;
}
for (int ii=4; ii<argc; ++ii) {
if (0 == strcmp(argv[ii], "-v"))
++verbose;
else if(0 == strcmp(argv[ii], "-q"))
--verbose;
else
throw std::runtime_error("Invalid command line option");
}
compare(argv[1], argv[2], epsilon_value, epsilon_index, epsilon_annot, epsilon_world);
return 0;
}
......
......@@ -13,6 +13,10 @@
# limitations under the License.
FROM centos:centos7
ENV LINUXDISTRO=centos7
ARG CLEAN_BUILD_COUNTER=1
ENV CLEAN_BUILD_COUNTER=${CLEAN_BUILD_COUNTER}
RUN yum -y install epel-release && \
yum -y install \
......
......@@ -16,6 +16,8 @@
FROM centos:centos7
RUN yum -y install python3 libgomp; python3 -m pip install --upgrade pip
# Workaround for a bug in the Azure SDK or one of its dependencies.
RUN test -r /etc/ssl/cert.pem || ln -s /etc/pki/tls/cert.pem /etc/ssl/cert.pem
WORKDIR /home/build/oz
ADD deploy.tgz build/
RUN python3 -m pip install build/deploy/pure/OpenZGY-*.whl
......
......@@ -41,18 +41,22 @@ RUN tar xvf build/deploy/testscripts.tar; \
#RUN dnf -y install unzip; \
# (mkdir /usr/local/sdutil; \
# cd /usr/local/sdutil; \
# unzip /home/build/oz/oldtools/sdutil-2.2.50.zip); \
# unzip /home/build/oz/oldtools/sdutil-p4d-2.2.272.zip); \
# sed -i -e '1s/python$/python3/' /usr/local/sdutil/sdutil.py; \
# chmod 755 /usr/local/sdutil/sdutil.py; \
# ln -s /usr/local/sdutil/sdutil.py /usr/local/bin/sdutil; \
# pip3 install -r /usr/local/sdutil/requirements.txt; \
# mkdir /home/build/.sdcfg; \
# ln -s /host/data/slbauth.tk /home/build/.sdcfg/slbauth.tk; \
# cp -b -S .orig oldtools/config.yaml /usr/local/sdutil/sdlib/config.yaml
# mkdir /home/build/.sdcfg;
## ln -s /host/data/slbauth.tk /home/build/.sdcfg/slbauth.tk
## cp -b -S .orig oldtools/config.yaml /usr/local/sdutil/sdlib/config.yaml
# Optional: Run as a regular user
RUN adduser -u 800 -g users -G wheel build; \
dnf -y install sudo; \
dnf -y install sudo procps-ng psmisc; \
echo 'build ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers; \
chown -R build /home/build
# Copy additional files for ad-hoc tests.
#COPY --chown=800 [ "private/zgyconvert-perftest.sh*", "private/Volve*", "/home/build/" ]
USER build
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment