Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up the build process and related tests #64

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14, linux-gpu-cuda]
offload: [acc, ompgpu]
offload: [cpu, acc, ompgpu]
exclude:
- os: ubuntu-latest
offload: acc
- os: linux-gpu-cuda
offload: cpu
- os: macos-14
offload: acc
- os: macos-14
offload: ompgpu
- os: macos-13
offload: acc
- os: macos-13
offload: ompgpu
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -58,15 +62,20 @@ jobs:
clang -v
fi
which h5c++
if [[ "$(uname -s)" == "Linux" ]];
export PERFORMING_CONDA_BUILD=True
export BUILD_OFFLOAD=${{ matrix.offload }}
if [[ "$(uname -s)" == "Linux" ]] && [[ "x${BUILD_OFFLOAD}" != "xcpu" ]];
then
# install PGI but do not source it
# the makefile will do it automatically
./scripts/install_hpc_sdk.sh </dev/null
fi
df -h .
export PERFORMING_CONDA_BUILD=True
export BUILD_OFFLOAD=${{ matrix.offload }}
if [[ "x${BUILD_OFFLOAD}" == "xcpu" ]];
then
# CPU-only builds use no GPU
export NOGPU=1
fi
echo "======= begin env ====="
env
echo "======= end env ====="
Expand Down
125 changes: 85 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,93 +1,138 @@
.PHONY: test clean all
.PHONY: test clean all clean_install

# Note: This Makefile will NOT properly work with the -j option

PLATFORM := $(shell uname -s)
COMPILER := $(shell ($(CXX) -v 2>&1) | tr A-Z a-z )

ifeq ($(PLATFORM),Darwin)
all: api main install test_binaries
# no GPU support for MacOS
all:
$(MAKE) api
$(MAKE) install
$(MAKE) main
$(MAKE) install_main
$(MAKE) test_binaries

clean:
-cd test && $(MAKE) clean
-cd src && $(MAKE) clean

clean_install:
-cd src && $(MAKE) clean_install

else
# Linux with optional GPU support

# Note: important that all_nv is after all_cpu_basic and all_nv_avx2 for tests to work
all: all_cpu_basic all_nv_avx2 all_nv all_combined test_binaries_nv
ifndef NOGPU

all_cpu_basic: api_cpu_basic main_cpu_basic install_cpu_basic
all:
$(MAKE) all_cpu_basic
$(MAKE) all_nv_avx2
$(MAKE) all_nv
$(MAKE) all_combined
$(MAKE) test_binaries

all_nv: api_nv main_nv install_nv
clean:
-cd test && $(MAKE) clean
-export BUILD_VARIANT=cpu_basic; cd src && $(MAKE) clean
-export BUILD_VARIANT=nv; cd src && $(MAKE) clean
-export BUILD_VARIANT=nv_avx2; cd src && $(MAKE) clean
-cd combined && $(MAKE) clean

clean_install:
-export BUILD_VARIANT=cpu_basic; cd src && $(MAKE) clean_install
-export BUILD_VARIANT=nv; cd src && $(MAKE) clean_install
-export BUILD_VARIANT=nv_avx2; cd src && $(MAKE) clean_install
-cd combined && $(MAKE) clean_install

all_nv_avx2: api_nv_avx2 main_nv_avx2 install_nv_avx2
else

all_combined: api_combined install_combined
all:
$(MAKE) all_cpu_basic
$(MAKE) all_combined
$(MAKE) test_binaries

clean:
-cd test && $(MAKE) clean
-export BUILD_VARIANT=cpu_basic; cd src && $(MAKE) clean
-cd combined && $(MAKE) clean

clean_install:
-export BUILD_VARIANT=cpu_basic; cd src && $(MAKE) clean_install
-cd combined && $(MAKE) clean_install

endif

clean:
-cd test && make clean
-cd src && make clean
-cd combined && make clean
all_cpu_basic:
$(MAKE) api_cpu_basic
$(MAKE) install_cpu_basic

all_nv:
$(MAKE) api_nv
$(MAKE) install_nv

all_nv_avx2:
$(MAKE) api_nv_avx2
$(MAKE) install_nv_avx2

all_combined:
$(MAKE) api_combined
$(MAKE) install_combined
$(MAKE) main
$(MAKE) install_main

endif

########### api

api:
cd src && make api
cd src && $(MAKE) clean && $(MAKE) api

api_cpu_basic:
export BUILD_VARIANT=cpu_basic ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make clean && make api
export BUILD_VARIANT=cpu_basic ; export BUILD_FULL_OPTIMIZATION=False ; cd src && $(MAKE) clean && $(MAKE) api

api_nv:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make clean && make api
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && $(MAKE) clean && $(MAKE) api

api_nv_avx2:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv_avx2 ; export BUILD_FULL_OPTIMIZATION=True ; cd src && make clean && make api
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv_avx2 ; export BUILD_FULL_OPTIMIZATION=True ; cd src && $(MAKE) clean && $(MAKE) api

api_combined:
cd combined && make api
cd combined && $(MAKE) clean && $(MAKE) api

########### main

main:
cd src && make main

main_cpu_basic:
export BUILD_VARIANT=cpu_basic ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make main
cd src && $(MAKE) clean && $(MAKE) main

main_nv:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make main

main_nv_avx2:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv_avx2 ; export BUILD_FULL_OPTIMIZATION=True ; cd src && make main
install_main:
cd src && $(MAKE) install

########### install

install:
cd src && make install
cd src && $(MAKE) install_lib

install_cpu_basic:
export BUILD_VARIANT=cpu_basic ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make install
export BUILD_VARIANT=cpu_basic ; export BUILD_FULL_OPTIMIZATION=False ; cd src && $(MAKE) install_lib

install_nv:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make install
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && $(MAKE) install_lib

install_nv_avx2:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv_avx2 ; export BUILD_FULL_OPTIMIZATION=True ; cd src && make install
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv_avx2 ; export BUILD_FULL_OPTIMIZATION=True ; cd src && $(MAKE) install_lib

install_combined:
cd combined && make install
cd combined && $(MAKE) install

########### test

test_binaries:
cd src && make test_binaries
cd test && make test_binaries

test_binaries_nv:
. ./setup_nv_h5.sh; export BUILD_VARIANT=nv ; export BUILD_FULL_OPTIMIZATION=False ; cd src && make test_binaries
# use the default compiler for the test subdir as it tests the combined shlib
cd test && make test_binaries
cd src && $(MAKE) clean && $(MAKE) test_binaries
cd test && $(MAKE) clean && $(MAKE) test_binaries

test:
cd src && make test
cd test && make test
cd src && $(MAKE) test
cd test && $(MAKE) test

15 changes: 10 additions & 5 deletions combined/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all api main install clean
.PHONY: all api main install clean clean_install

all: api install

Expand All @@ -12,16 +12,21 @@ ifeq ($(PREFIX),)
PREFIX := $(CONDA_PREFIX)
endif

ifdef NOGPU
CFLAGS += -DBASIC_ONLY
endif

libssu.o: libssu.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c libssu.c -fPIC

libssu.so: libssu.o
$(CC) -shared -o libssu.so libssu.o -fPIC -ldl $(LDFLAGS)

install: libssu.so
rm -f ${PREFIX}/lib//libssu.so; cp libssu.so ${PREFIX}/lib/
rm -f ${PREFIX}/bin/ssu; cp ssu ${PREFIX}/bin/
rm -f ${PREFIX}/bin/faithpd; cp faithpd ${PREFIX}/bin/
rm -f ${PREFIX}/lib/libssu.so; cp libssu.so ${PREFIX}/lib/

clean:
rm -f libssu.o libssu.so
rm -f libssu.o

clean_install:
rm -f ${PREFIX}/lib/libssu.so
44 changes: 0 additions & 44 deletions combined/faithpd

This file was deleted.

Loading
Loading