Skip to content

Commit

Permalink
Remove all support for C in the build system
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaddy committed Mar 7, 2023
1 parent a94a4d2 commit 4a92255
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 70 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ jobs:
- name: Display tidy_results_cpp.log
if: ${{ (matrix.container.name == 'CUDA') && (always()) }}
run: cat tidy_results_cpp.log
- name: Display tidy_results_c.log
if: ${{ (matrix.container.name == 'CUDA') && (always()) }}
run: cat tidy_results_c.log
- name: Display tidy_results_gpu.log
if: ${{ (matrix.container.name == 'CUDA') && (always()) }}
run: cat tidy_results_gpu.log
25 changes: 4 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ DIRS := src src/analysis src/chemistry_gpu src/cooling src/cooling_grackle s

SUFFIX ?= .$(TYPE).$(MACHINE)

CFILES := $(foreach DIR,$(DIRS),$(wildcard $(DIR)/*.c))
CPPFILES := $(foreach DIR,$(DIRS),$(wildcard $(DIR)/*.cpp))
GPUFILES := $(foreach DIR,$(DIRS),$(wildcard $(DIR)/*.cu))

# Build a list of all potential object files so cleaning works properly
CLEAN_OBJS := $(subst .c,.o,$(CFILES)) \
$(subst .cpp,.o,$(CPPFILES)) \
CLEAN_OBJS := $(subst .cpp,.o,$(CPPFILES)) \
$(subst .cu,.o,$(GPUFILES))

# Check if it should include testing flags
Expand All @@ -49,30 +47,24 @@ ifeq ($(ADD_TEST_FLAGS), yes)
SUFFIX := $(strip $(SUFFIX)).tests
LIBS += -L$(GOOGLETEST_ROOT)/lib64 -pthread -lgtest -lhdf5_cpp
TEST_FLAGS = -I$(GOOGLETEST_ROOT)/include
CFLAGS += $(TEST_FLAGS)
CXXFLAGS += $(TEST_FLAGS)
GPUFLAGS += $(TEST_FLAGS)
else
# This isn't a test build so clear out testing related files
CFILES := $(filter-out src/system_tests/% %_tests.c,$(CFILES))
CPPFILES := $(filter-out src/system_tests/% %_tests.cpp,$(CPPFILES))
CPPFILES := $(filter-out src/utils/testing_utilities.cpp,$(CPPFILES))
GPUFILES := $(filter-out src/system_tests/% %_tests.cu,$(GPUFILES))
endif

OBJS := $(subst .c,.o,$(CFILES)) \
$(subst .cpp,.o,$(CPPFILES)) \
OBJS := $(subst .cpp,.o,$(CPPFILES)) \
$(subst .cu,.o,$(GPUFILES))

#-- Set default compilers and flags
CC ?= cc
CXX ?= CC

CFLAGS_OPTIMIZE ?= -g -Ofast
CXXFLAGS_OPTIMIZE ?= -g -Ofast -std=c++17
GPUFLAGS_OPTIMIZE ?= -g -O3 -std=c++17

CFLAGS_DEBUG ?= -g -O0
CXXFLAGS_DEBUG ?= -g -O0 -std=c++17
ifdef HIPCONFIG
GPUFLAGS_DEBUG ?= -g -O0 -std=c++17
Expand All @@ -82,13 +74,11 @@ endif

BUILD ?= OPTIMIZE

CFLAGS += $(CFLAGS_$(BUILD))
CXXFLAGS += $(CXXFLAGS_$(BUILD))
GPUFLAGS += $(GPUFLAGS_$(BUILD))

#-- Add flags and libraries as needed

CFLAGS += $(DFLAGS) -Isrc
CXXFLAGS += $(DFLAGS) -Isrc
GPUFLAGS += $(DFLAGS) -Isrc

Expand Down Expand Up @@ -170,7 +160,7 @@ ifeq ($(findstring -DCHEMISTRY_GPU,$(DFLAGS)),-DCHEMISTRY_GPU)
DFLAGS += -DSCALAR
endif

.SUFFIXES: .c .cpp .cu .o
.SUFFIXES: .cpp .cu .o

EXEC := bin/cholla$(SUFFIX)

Expand All @@ -184,27 +174,21 @@ DFLAGS += $(MACRO_FLAGS)
LIBS_CLANG_TIDY := $(subst -I/, -isystem /,$(LIBS))
LIBS_CLANG_TIDY += -isystem $(MPI_ROOT)/include
CXXFLAGS_CLANG_TIDY := $(subst -I/, -isystem /,$(LDFLAGS))
CFLAGS_CLANG_TIDY := $(subst -I/, -isystem /,$(CFLAGS))
GPUFLAGS_CLANG_TIDY := $(subst -I/, -isystem /,$(GPUFLAGS))
GPUFLAGS_CLANG_TIDY := $(filter-out -ccbin=mpicxx -fmad=false --expt-extended-lambda,$(GPUFLAGS))
GPUFLAGS_CLANG_TIDY += --cuda-host-only --cuda-path=$(CUDA_ROOT) -isystem /clang/includes
CPPFILES_TIDY := $(CPPFILES)
CFILES_TIDY := $(CFILES)
GPUFILES_TIDY := $(GPUFILES)

ifdef TIDY_FILES
CPPFILES_TIDY := $(filter $(TIDY_FILES), $(CPPFILES_TIDY))
CFILES_TIDY := $(filter $(TIDY_FILES), $(CFILES_TIDY))
GPUFILES_TIDY := $(filter $(TIDY_FILES), $(GPUFILES_TIDY))
endif

$(EXEC): prereq-build $(OBJS)
mkdir -p bin/ && $(LD) $(LDFLAGS) $(OBJS) -o $(EXEC) $(LIBS)
eval $(EXTRA_COMMANDS)

%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@

Expand All @@ -221,9 +205,8 @@ tidy:
# - --warnings-as-errors=<string> Upgrade all warnings to error, good for CI
clang-tidy --verify-config
(time clang-tidy $(CLANG_TIDY_ARGS) $(CPPFILES_TIDY) -- $(DFLAGS) $(CXXFLAGS_CLANG_TIDY) $(LIBS_CLANG_TIDY)) > tidy_results_cpp.log 2>&1 & \
(time clang-tidy $(CLANG_TIDY_ARGS) $(CFILES_TIDY) -- $(DFLAGS) $(CFLAGS_CLANG_TIDY) $(LIBS_CLANG_TIDY)) > tidy_results_c.log 2>&1 & \
(time clang-tidy $(CLANG_TIDY_ARGS) $(GPUFILES_TIDY) -- $(DFLAGS) $(GPUFLAGS_CLANG_TIDY) $(LIBS_CLANG_TIDY)) > tidy_results_gpu.log 2>&1 & \
for i in 1 2 3; do wait -n; done
for i in 1 2; do wait -n; done

clean:
rm -f $(CLEAN_OBJS)
Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.c3po
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#-- Compiler and flags for different build type
CC = mpicc
CXX = mpicxx
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -g -O2
CXXFLAGS_DEBUG = -g -O0 -std=c++17 ${F_OFFLOAD}
CXXFLAGS_OPTIMIZE = -g -Ofast -std=c++17 ${F_OFFLOAD}
GPUFLAGS_DEBUG = -g -G -cudart shared -O0 -std=c++17 -ccbin=mpicxx -Xcompiler -rdynamic
Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.crc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

#-- Compiler and flags for different build type
CC = mpicc
CXX = mpicxx
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -Ofast
CXXFLAGS_DEBUG = -g -O0 -std=c++17
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17
GPUFLAGS_OPTIMIZE = -g -O3 -std=c++17
Expand Down
4 changes: 0 additions & 4 deletions builds/make.host.frontier
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#-- make.host for Frontier at the OLCF with
#-- Compiler and flags for different build type
CC = cc
CXX = CC
#GPUCXX ?= CC -x hip
GPUCXX ?= hipcc

CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -g -O2

CXXFLAGS_DEBUG = -g -O0 -std=c++17
CXXFLAGS_OPTIMIZE = -g -Ofast -std=c++17 -Wno-unused-result

Expand Down
5 changes: 0 additions & 5 deletions builds/make.host.github
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#-- Compiler and flags for different build type
CC = mpicc
CXX = mpicxx
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -g -O2
CXXFLAGS_DEBUG = -g -O0 -std=c++17 ${F_OFFLOAD}
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17 ${F_OFFLOAD}
GPUFLAGS_DEBUG = -g -G -cudart shared -O0 -std=c++17
Expand All @@ -27,8 +24,6 @@ GOOGLETEST_ROOT := ${GOOGLETEST_ROOT}

ifdef HIPCONFIG
MPI_ROOT := ${MPI_ROOT}
CFLAGS_DEBUG += -fPIE
CFLAGS_OPTIMIZE += -fPIE
CXXFLAGS_DEBUG += -fPIE
CXXFLAGS_OPTIMIZE += -fPIE
GPUFLAGS_DEBUG += -fPIE
Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.lux
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#-- make.inc for the Shamrock Server

#-- Compiler and flags for different build type
CC = mpicc
CXX = mpicxx
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -g -O2
CXXFLAGS_DEBUG = -g -O0 -std=c++17
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17
GPUFLAGS = -std=c++17
Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.poplar
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#-- make.inc for Poplar, COE cluster at HPE

#-- Compiler and flags for different build type
CC = cc
CXX = CC
CFLAGS_DEBUG = -g -O0 ${F_OFFLOAD}
CFLAGS_OPTIMIZE = -Ofast ${F_OFFLOAD}
CXXFLAGS_DEBUG = -g -O0 -std=c++17 ${F_OFFLOAD}
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17 ${F_OFFLOAD}

Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.poplar.aomp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#-- make.inc for Poplar, COE cluster at HPE

#-- Compiler and flags for different build type
CC = mpicc
CXX = mpicxx
HIPCONFIG = $(shell hipconfig -C)
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -Ofast
CXXFLAGS_DEBUG = -g -O0 -std=c++17
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17

Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.poplar.cce+hip
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#-- make.inc for Poplar, HPE COE cluster

#-- Compiler and flags for different build type
CC = cc
CXX = CC
HIPCONFIG = $(shell hipconfig -C)
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -Ofast
CXXFLAGS_DEBUG = -g -O0 -std=c++17
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17

Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.shamrock
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#-- make.inc for the Lux Cluster

#-- Compiler and flags for different build type
CC = mpicc
CXX = mpicxx
#CC = gcc
#CXX = g++
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -g -O2
CXXFLAGS_DEBUG = -g -O0 -std=c++17
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17

Expand Down
4 changes: 0 additions & 4 deletions builds/make.host.spock
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#-- make.inc for Spock EAS at the OLCF with

#-- Compiler and flags for different build type
CC = cc
CXX = CC

CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -g -O2

CXXFLAGS_DEBUG = -g -O0 -std=c++17
CXXFLAGS_OPTIMIZE = -g -Ofast -std=c++17

Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.summit
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
# https://www.olcf.ornl.gov/summit/

#-- Compiler and flags for different build type
CC = mpicc
CXX = mpicxx
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -g -O2
CXXFLAGS_DEBUG = -g -O0 -std=c++17 ${F_OFFLOAD}
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17 ${F_OFFLOAD}
GPUFLAGS_DEBUG = -g -O0 -std=c++17 -ccbin=mpicxx -G -cudart shared
Expand Down
3 changes: 0 additions & 3 deletions builds/make.host.tornado
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#-- make.inc for the Lux Cluster

#-- Compiler and flags for different build type
CC = gcc
CXX = g++
CFLAGS_DEBUG = -g -O0
CFLAGS_OPTIMIZE = -g -O2
CXXFLAGS_DEBUG = -g -O0 -std=c++17
CXXFLAGS_OPTIMIZE = -Ofast -std=c++17

Expand Down
3 changes: 1 addition & 2 deletions builds/setup.poplar.aomp.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/bin/bash

module purge
module load craype-x86-naples craype-network-infiniband
module load craype-x86-naples craype-network-infiniband
module load shared slurm
module use /home/users/twhite/share/modulefiles
module load ompi/4.0.4-rocm-3.9 hdf5

export OMPI_CC=$(which clang)
export OMPI_CXX=$(which clang)

export CHOLLA_MACHINE=poplar.aomp
Expand Down
6 changes: 2 additions & 4 deletions tools/analyze_tidy_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
failures a check represents.
When running, make sure that you have already run clang-tidy with all the
checks you want enabled since this script looks for the 3 tidy_results_*.log
checks you want enabled since this script looks for the 2 tidy_results_*.log
files in the root directory of Cholla
================================================================================
"""
Expand Down Expand Up @@ -35,14 +35,12 @@ def main():


def loadTidyResults(chollaPath):
with open(chollaPath / "tidy_results_c.log", "r") as file:
cData = file.read()
with open(chollaPath / "tidy_results_cpp.log", "r") as file:
cppData = file.read()
with open(chollaPath / "tidy_results_gpu.log", "r") as file:
gpuData = file.read()

return cData + cppData + gpuData
return cppData + gpuData


def getEnabledChecks(chollaPath):
Expand Down

0 comments on commit 4a92255

Please sign in to comment.