Skip to content

Commit

Permalink
ifx test (-O3 not passed for p61)
Browse files Browse the repository at this point in the history
  • Loading branch information
han190 committed Mar 8, 2024
1 parent 4c9a939 commit 8c1075d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
29 changes: 21 additions & 8 deletions makefile → Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
fortran_compiler?=gfortran
compiler?=gfortran
profile?=release
src_dir:=src
current_dir=$(dir $(realpath $(lastword $(MAKEFILE_LIST))))
build_dir=$(current_dir)build/$(fortran_compiler)_$(profile)_makefile
build_dir=$(current_dir)build/$(compiler)_$(profile)_makefile
data_dir=$(current_dir)data
include_dir=$(build_dir)/include
local_dir=${HOME}/.local
prefix=$(local_dir)/bin
data_prefix=$(local_dir)/share/PE-Fortran-data
args?=

ifeq ($(fortran_compiler), gfortran)
compiler_flags=-std=f2018
ifeq ($(compiler), gfortran)
compiler_flags=-std=f2018 -march=native
ifeq ($(profile), debug)
compiler_flags+=-g -o0 -Wall -Wextra -pedantic -fbounds-check \
compiler_flags+=-g -O0 -Wall -Wextra -pedantic -fbounds-check \
-fimplicit-none -fPIC -Wno-uninitialized -fcheck=all -fbacktrace \
-ffree-form -fcheck=array-temps -Werror=implicit-interface
else ifeq ($(profile), release)
compiler_flags+=-O3 -march=native
endif
compile=$(fortran_compiler) $(compiler_flags) \
compile=$(compiler) $(compiler_flags) \
-I$(include_dir) -J$(build_dir)
else ifeq ($(compiler), ifx)
compiler_flags=-stand f18 -mtune=native
ifeq ($(profile), debug)
compiler_flags+=-O0 -warn all -check all,nouninit -g -traceback -no-simd
else ifeq ($(profile), release)
compiler_flags+=-O1 -ipo -xHost
endif
compile=$(compiler) $(compiler_flags) \
-I$(include_dir) -module $(build_dir)
AR=xiar
endif

# Preprocess objects
Expand Down Expand Up @@ -94,6 +104,9 @@ build:

clean:
$(RM) -r $(build_dir)
$(RM) $(prefix)/PE-Fortran $(prefix)/preprocess
@echo Build files cleaned.

uninstall:
$(RM) $(prefix)/PE-Fortran $(prefix)/PE-Preprocess
$(RM) -r $(data_prefix)
@echo All files cleaned.
@echo PE-Fortran uninstalled.
26 changes: 13 additions & 13 deletions src/problems/problem_0054.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pure subroutine rank_(hands, s_arr)

! Royal Flush
if (all(vals(10:14) == 1) .and. any(suits(:) == 5)) then
x = findloc(suits, 5, dim=1)
x = findloc(suits, 5_int64, dim=1)
s_arr(1:2) = [10_int64, x]
return
end if
Expand All @@ -61,7 +61,7 @@ pure subroutine rank_(hands, s_arr)
if (any(suits(:) == 5)) then
do x = 1, 10
if (all(vals(x:x + 4) == 1)) then
y = findloc(suits, 5, dim=1)
y = findloc(suits, 5_int64, dim=1)
s_arr(1:3) = [9_int64, x, y]
return
end if
Expand All @@ -70,16 +70,16 @@ pure subroutine rank_(hands, s_arr)

! Four of a kind
if (any(vals(:) == 4)) then
x = findloc(vals, 4, dim=1, back=.true.)
y = findloc(vals, 1, dim=1, back=.true.)
x = findloc(vals, 4_int64, dim=1, back=.true.)
y = findloc(vals, 1_int64, dim=1, back=.true.)
s_arr(1:3) = [8_int64, x, y]
return
end if

! Full house
if (any(vals(:) == 3) .and. any(vals(:) == 2)) then
x = findloc(vals, 3, dim=1, back=.true.)
y = findloc(vals, 2, dim=1, back=.true.)
x = findloc(vals, 3_int64, dim=1, back=.true.)
y = findloc(vals, 2_int64, dim=1, back=.true.)
s_arr(1:3) = [7_int64, x, y]
return
end if
Expand All @@ -101,25 +101,25 @@ pure subroutine rank_(hands, s_arr)

! Three of a kind
if (any(vals(:) == 3)) then
x = findloc(vals, 3, dim=1, back=.true.)
y = findloc(vals, 1, dim=1, back=.true.)
z = findloc(vals(2:14), 1, dim=1) + 1
x = findloc(vals, 3_int64, dim=1, back=.true.)
y = findloc(vals, 1_int64, dim=1, back=.true.)
z = findloc(vals(2:14), 1_int64, dim=1) + 1
s_arr(1:4) = [4_int64, x, y, z]
return
end if

! Two pairs
if (count(vals(2:14) == 2) == 2) then
x = findloc(vals, 2, dim=1, back=.true.)
y = findloc(vals(2:14), 2, dim=1) + 1
z = findloc(vals, 1, dim=1, back=.true.)
x = findloc(vals, 2_int64, dim=1, back=.true.)
y = findloc(vals(2:14), 2_int64, dim=1) + 1
z = findloc(vals, 1_int64, dim=1, back=.true.)
s_arr(1:4) = [3_int64, x, y, z]
return
end if

! One pair
if (any(vals(:) == 2)) then
x = findloc(vals, 2, dim=1, back=.true.)
x = findloc(vals, 2_int64, dim=1, back=.true.)
s_arr(1:2) = [2_int64, x]
call knt_one_by_one(3_int64, vals, s_arr)
return
Expand Down
2 changes: 1 addition & 1 deletion src/problems/problem_0061.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ end subroutine euler0061
pure logical function ouroboric(x)
integer(int64), intent(in) :: x(:)

ouroboric = x(1)/100 == mod(x(size(x)), 100_int64)
ouroboric = x(1)/100_int64 == mod(x(size(x)), 100_int64)
end function ouroboric

pure subroutine get_cyclic(x, y)
Expand Down

0 comments on commit 8c1075d

Please sign in to comment.