-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #697 from ThePortlandGroup/nv_stage
Migrate NCAR kernels tests to Flang
- Loading branch information
Showing
697 changed files
with
126,029 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CESM Kernel License | ||
|
||
The Community Earth System Model (CESM) was developed in cooperation with the National Science Foundation, the Department of Energy, the National Aeronautics and Space Administration, and the University Corporation for Atmospheric Research National Center for Atmospheric Research. | ||
|
||
THIS SOFTWARE IS PROVIDED BY UCAR AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UCAR OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
Except for the segregable components listed in the table below, CESM is public domain software. The following components are copyrighted and may only be used, modified, or redistributed under the terms indicated below. | ||
|
||
Code Institution Copyright Terms of Use/Disclaimer | ||
POP University of Illinois/NCSA Copyright 2002-2009, University of Illinois/NCSA Open Source License University of Illinois/NCSA Open Source License (http://opensource.org/licenses/NCSA) | ||
AER RRTMG Los Alamos National Laboratory Copyright 2013 Los Alamos National Security, LLC Los Alamos National Security, LLC (http://oceans11.lanl.gov/trac/CICE/wiki/CopyRight) | ||
MCT LANL/U. Bristol/U. Edinburgh/U. Montana/U. Swansea) Copyright 2014, GNU Lesser General Public License GNU Lesser General Public License | ||
|
||
This is a copy of the text of the license file from https://github.com/NCAR/kernelOptimization/blob/master/all/CAM5_mg2_pgi/CESM_Kernel_License_091118.docx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
MG2 kernel | ||
|
||
For general information about MG2 kernel, please read README in https://subversion.ucar.edu/pubasap/kernels/MG2. | ||
|
||
This version of MG2 is generated from rev. 69541 of https://svn-ccsm-models.cgd.ucar.edu/cam1/trunk_tags/cam5_3_74 using PGI compiler. | ||
|
||
Please contact Youngsung Kim([email protected]) for any questions concerning this kernel. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
# PGI default flags | ||
# | ||
# FC_FLAGS := -fast -Mipa=fast,inline | ||
# | ||
# Intel default flags | ||
# | ||
# FC_FLAGS := -O2 -fp-model source -convert big_endian -assume byterecl | ||
# -ftz -traceback -assume realloc_lhs -xAVX | ||
# | ||
# Makefile for KGEN-generated kernel | ||
FC_FLAGS := $(OPT) | ||
FC_FLAGS += $(OPT) -O -Kieee -Mnofma | ||
|
||
ifeq ("$(FC)", "pgf90") | ||
endif | ||
ifeq ("$(FC)", "pgfortran") | ||
endif | ||
ifeq ("$(FC)", "flang") | ||
endif | ||
ifeq ("$(FC)", "gfortran") | ||
endif | ||
ifeq ("$(FC)", "ifort") | ||
endif | ||
ifeq ("$(FC)", "xlf") | ||
endif | ||
|
||
|
||
ALL_OBJS := kernel_driver.o micro_mg_cam.o micro_mg_utils.o shr_kind_mod.o micro_mg2_0.o shr_spfn_mod.o wv_sat_methods.o shr_const_mod.o | ||
|
||
verify: | ||
@(grep "verification.FAIL" $(TEST).rslt && echo "FAILED") || (grep "verification.PASS" $(TEST).rslt -q && echo PASSED) | ||
|
||
run: build | ||
@mkdir rundir ; if [ ! -d data ] ; then ln -s $(SRC)/data data && echo "symlinked data directory: ln -s $(SRC)/data data"; fi; cd rundir; ../kernel.exe >> ../$(TEST).rslt 2>&1 || ( echo RUN FAILED: DID NOT EXIT 0) | ||
# symlink data/ so it can be found in the directory made by lit | ||
@echo ----------------------run-ouput-was---------- | ||
@cat $(TEST).rslt | ||
|
||
build: ${ALL_OBJS} | ||
${FC} ${FC_FLAGS} -o kernel.exe $^ | ||
|
||
kernel_driver.o: $(SRC_DIR)/kernel_driver.f90 micro_mg_cam.o micro_mg_utils.o shr_kind_mod.o micro_mg2_0.o shr_spfn_mod.o wv_sat_methods.o shr_const_mod.o | ||
${FC} ${FC_FLAGS} -c -o $@ $< | ||
|
||
micro_mg_cam.o: $(SRC_DIR)/micro_mg_cam.F90 micro_mg2_0.o shr_kind_mod.o | ||
${FC} ${FC_FLAGS} -c -o $@ $< | ||
|
||
micro_mg_utils.o: $(SRC_DIR)/micro_mg_utils.F90 shr_spfn_mod.o | ||
${FC} ${FC_FLAGS} -c -o $@ $< | ||
|
||
shr_kind_mod.o: $(SRC_DIR)/shr_kind_mod.F90 | ||
${FC} ${FC_FLAGS} -c -o $@ $< | ||
|
||
micro_mg2_0.o: $(SRC_DIR)/micro_mg2_0.F90 micro_mg_utils.o wv_sat_methods.o shr_spfn_mod.o | ||
${FC} ${FC_FLAGS} -c -o $@ $< | ||
|
||
shr_spfn_mod.o: $(SRC_DIR)/shr_spfn_mod.F90 shr_kind_mod.o shr_const_mod.o | ||
${FC} ${FC_FLAGS} -c -o $@ $< | ||
|
||
wv_sat_methods.o: $(SRC_DIR)/wv_sat_methods.F90 | ||
${FC} ${FC_FLAGS} -c -o $@ $< | ||
|
||
shr_const_mod.o: $(SRC_DIR)/shr_const_mod.F90 shr_kind_mod.o | ||
${FC} ${FC_FLAGS} -c -o $@ $< | ||
|
||
clean: | ||
rm -f kernel.exe *.mod *.o *.rslt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
test_name=${TEST_SRC##*/} # Strip path. | ||
test_name=${test_name%.*} # Strip extension. | ||
|
||
temp_dir="$test_name" | ||
rm -rf $temp_dir | ||
|
||
MAKE_FILE=$MAKE_FILE_DIR/makefile | ||
|
||
mkdir $temp_dir | ||
if [[ ! $KEEP_FILES ]]; then | ||
# If keep files is not specified, remove these files at the end. | ||
trap "rm -rf $(pwd)/$temp_dir" EXIT | ||
fi | ||
cd $temp_dir | ||
export PATH=$PATH:$(pwd) | ||
|
||
make -f $MAKE_FILE HOMEQA=$MAKE_FILE_DIR TEST=$test_name OPT="$FLAGS" build 2>&1 | ||
make -f $MAKE_FILE HOMEQA=$MAKE_FILE_DIR TEST=$test_name OPT="$FLAGS" run 2>&1 | ||
make -f $MAKE_FILE HOMEQA=$MAKE_FILE_DIR TEST=$test_name OPT="$FLAGS" verify 2>&1 | ||
# CHECK: {{([1-9][0-9]* tests PASSED\. 0 tests failed|[[:space:]]*PASS(ED)?[[:space:]]*$)}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Shared lit script for each tests. Run bash commands that run tests with make. | ||
|
||
# RUN: KEEP_FILES=%keep FLAGS=%flags TEST_SRC=%s MAKE_FILE_DIR=%S/.. bash %S/runmake | tee %t | ||
# RUN: cat %t | FileCheck %S/runmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# makefile for NCAR Kernel tests. | ||
|
||
|
||
#TEST_DIR=./src | ||
SRC=$(HOMEQA) | ||
INCLUDES = $(HOMEQA)/inc | ||
SRC_DIR=$(SRC)/src | ||
FC=flang | ||
OBJX=o | ||
EXTRA_CFLAGS= | ||
EXTRA_FFLAGS= | ||
LD=$(FC) | ||
RUN= | ||
OPT= | ||
ENDIAN= | ||
FFLAGS=$(OPT) | ||
LDFLAGS=$(EXTRA_LDFLAGS) | ||
LIBS=$(EXTRA_LIBS) | ||
KIEE= | ||
CFLAGS=$(OPT) $(EXTRA_CFLAGS) | ||
EXE=out | ||
|
||
|
||
RM=rm -f | ||
|
||
TEST = t1 | ||
include $(INCLUDES)/$(TEST).mk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
! KGEN-generated Fortran source file | ||
! | ||
! Filename : kernel_driver.f90 | ||
! Generated at: 2015-03-31 09:44:40 | ||
! KGEN version: 0.4.5 | ||
|
||
|
||
PROGRAM kernel_driver | ||
USE micro_mg_cam, ONLY : micro_mg_cam_tend | ||
USE shr_kind_mod, ONLY: r8 => shr_kind_r8 | ||
USE micro_mg_cam, ONLY : kgen_read_externs_micro_mg_cam | ||
USE micro_mg_utils, ONLY : kgen_read_externs_micro_mg_utils | ||
USE micro_mg2_0, ONLY : kgen_read_externs_micro_mg2_0 | ||
USE wv_sat_methods, ONLY : kgen_read_externs_wv_sat_methods | ||
|
||
IMPLICIT NONE | ||
|
||
INTEGER :: kgen_mpi_rank | ||
CHARACTER(LEN=16) ::kgen_mpi_rank_conv | ||
INTEGER, DIMENSION(3), PARAMETER :: kgen_mpi_rank_at = (/ 0, 100, 300 /) | ||
INTEGER :: kgen_ierr, kgen_unit | ||
INTEGER :: kgen_repeat_counter | ||
INTEGER :: kgen_counter | ||
CHARACTER(LEN=16) :: kgen_counter_conv | ||
INTEGER, DIMENSION(3), PARAMETER :: kgen_counter_at = (/ 10, 100, 50 /) | ||
CHARACTER(LEN=1024) :: kgen_filepath | ||
REAL(KIND=r8) :: dtime | ||
|
||
DO kgen_repeat_counter = 0, 8 | ||
kgen_counter = kgen_counter_at(mod(kgen_repeat_counter, 3)+1) | ||
WRITE( kgen_counter_conv, * ) kgen_counter | ||
kgen_mpi_rank = kgen_mpi_rank_at(mod(kgen_repeat_counter, 3)+1) | ||
WRITE( kgen_mpi_rank_conv, * ) kgen_mpi_rank | ||
kgen_filepath = "../data/micro_mg_tend2_0." // trim(adjustl(kgen_counter_conv)) // "." // trim(adjustl(kgen_mpi_rank_conv)) | ||
kgen_unit = kgen_get_newunit() | ||
OPEN (UNIT=kgen_unit, FILE=kgen_filepath, STATUS="OLD", ACCESS="STREAM", FORM="UNFORMATTED", ACTION="READ", IOSTAT=kgen_ierr, CONVERT="BIG_ENDIAN") | ||
WRITE (*,*) | ||
IF ( kgen_ierr /= 0 ) THEN | ||
CALL kgen_error_stop( "FILE OPEN ERROR: " // trim(adjustl(kgen_filepath)) ) | ||
END IF | ||
WRITE (*,*) | ||
WRITE (*,*) "** Verification against '" // trim(adjustl(kgen_filepath)) // "' **" | ||
|
||
CALL kgen_read_externs_micro_mg_cam(kgen_unit) | ||
CALL kgen_read_externs_micro_mg_utils(kgen_unit) | ||
CALL kgen_read_externs_micro_mg2_0(kgen_unit) | ||
CALL kgen_read_externs_wv_sat_methods(kgen_unit) | ||
|
||
! driver variables | ||
READ(UNIT=kgen_unit) dtime | ||
|
||
call micro_mg_cam_tend(dtime, kgen_unit) | ||
|
||
CLOSE (UNIT=kgen_unit) | ||
END DO | ||
CONTAINS | ||
|
||
! write subroutines | ||
! No subroutines | ||
FUNCTION kgen_get_newunit() RESULT(new_unit) | ||
INTEGER, PARAMETER :: UNIT_MIN=100, UNIT_MAX=1000000 | ||
LOGICAL :: is_opened | ||
INTEGER :: nunit, new_unit, counter | ||
|
||
new_unit = -1 | ||
DO counter=UNIT_MIN, UNIT_MAX | ||
inquire(UNIT=counter, OPENED=is_opened) | ||
IF (.NOT. is_opened) THEN | ||
new_unit = counter | ||
EXIT | ||
END IF | ||
END DO | ||
END FUNCTION | ||
|
||
SUBROUTINE kgen_error_stop( msg ) | ||
IMPLICIT NONE | ||
CHARACTER(LEN=*), INTENT(IN) :: msg | ||
|
||
WRITE (*,*) msg | ||
STOP 1 | ||
END SUBROUTINE | ||
|
||
|
||
END PROGRAM kernel_driver |
Oops, something went wrong.