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

Compiler flags profiles #498

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ee0d46c
Initial branch commit - new_package subroutine parses TOML and loads …
kubajj May 31, 2021
a978be3
Add support for profiles defined with missing values
kubajj Jun 1, 2021
648764c
Add first implementation of find_profile subroutine
kubajj Jun 3, 2021
e8ea449
Temporary solution of adding compiler flags from profile to model
kubajj Jun 3, 2021
020c34a
Added built in profiles support, updated find_profile decision making
kubajj Jun 4, 2021
1caa897
Add error handling and basic testing for profiles
kubajj Jun 8, 2021
97085c6
Fix merge conflict
kubajj Jun 10, 2021
507d634
Simplify profiles handling before implementing package scope
kubajj Jun 11, 2021
5550bf7
Initial implementation of package scope compiler profiles
kubajj Jun 15, 2021
941c23b
Add file scope flags and representation of profiles as string for sho…
kubajj Jun 18, 2021
a1a503c
Change _ to - in toml fields names, minor changes in get_flags subrou…
kubajj Jun 21, 2021
f81132a
Merge pull requests
kubajj Jun 24, 2021
2989997
Add example pacakges with compiler profiles, remove c_flags from srcf…
kubajj Jun 28, 2021
709ad3a
Add an example project with c flags
kubajj Jun 28, 2021
0997172
Stop modifying model outside of build_model
kubajj Jun 30, 2021
cb06c00
Fix src/fpm_targets.f90 to run with no source files
kubajj Jul 22, 2021
cab4181
Fix merge conflicts
kubajj Jul 22, 2021
286ac9c
Remove failing line from fpm_targets.f90
kubajj Jul 22, 2021
98badd6
Update error handling in profiles parser and introduce is_built_in bo…
kubajj Jul 26, 2021
7d8ca4c
Add profiles hierarchy and propagation to dependencies
kubajj Jul 31, 2021
999c3a6
Implement suggested changes
kubajj Jul 31, 2021
981df56
Update ci test for windows
kubajj Jul 31, 2021
1e82f4e
Update profiles priorities test to use proprocessor
kubajj Jul 31, 2021
20084fe
Apply suggestions from code review
kubajj Jul 31, 2021
91323bf
Change stop to stop 1 in profiles_priorities example package
kubajj Jul 31, 2021
269416a
Prevent main package in profiles priorities from failing due to not b…
kubajj Jul 31, 2021
ba2c812
Fix merge conflict
kubajj Aug 9, 2021
ce59082
Add comments detailing the functions
kubajj Aug 9, 2021
789d823
Fox merge conflict with PR #533
kubajj Aug 9, 2021
794cd85
Apply suggestions from code review
kubajj Aug 9, 2021
a3978b8
Make new_dependency_node pure
kubajj Aug 9, 2021
e642a14
Make get_default_profiles neater
kubajj Aug 9, 2021
09e5b97
Apply some suggestions from code review
kubajj Aug 10, 2021
7d09b4f
Extend subroutine get_object_name
kubajj Aug 10, 2021
789175f
Merge branch 'Load_compiler_profiles' of github.com:kubajj/fpm into L…
kubajj Aug 10, 2021
d708b94
Close code fence and propagate error while reading manifest
kubajj Aug 10, 2021
fa52c0a
Cover invalid toml - only supported tables and fields are valid
kubajj Aug 12, 2021
1edf2f1
Last GSoC commit - Separate validation and reading when parsing toml …
kubajj Aug 13, 2021
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
27 changes: 27 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,32 @@ pushd c_header_only
"$fpm" build
popd

pushd profiles_with_c
"$fpm" build
"$fpm" run
popd

pushd program_with_compiler_profiles
"$fpm" build
"$fpm" run
popd

pushd program_with_free_form_in_dot_f
"$fpm" build
"$fpm" run
popd

pushd "program_with_profiles_scope/primary_package"
"$fpm" build
"$fpm" run
popd

pushd "profiles_priorities/main_package"
rm -rf build
"$fpm" build | sed -n 's,^.*/\([^/ ]*\.f90 .*\) -J .*$,\1,p' | sort > log.txt
cmp log.txt correct_log.txt
rm log.txt
popd

# Cleanup
rm -rf ./*/build
1 change: 1 addition & 0 deletions example_packages/profiles_priorities/d1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
7 changes: 7 additions & 0 deletions example_packages/profiles_priorities/d1/app/d1.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
program d1
use d1_m, only: say_hi

implicit none

call say_hi()
end program d1
18 changes: 18 additions & 0 deletions example_packages/profiles_priorities/d1/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name = "d1"

[library]
source-dir="source"

[[executable]]
name="d1"
source-dir="app"
main="d1.f90"

[profiles.debug.gfortran.linux]
flags="-g -O1"

[dependencies]
"d11" = {path = "../d11"}
"d12" = {path = "../d12"}


12 changes: 12 additions & 0 deletions example_packages/profiles_priorities/d1/source/d1_m.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module d1_m
use d11_m, only: create_greeting
use d12_m, only: get_name
implicit none

public :: say_hi
contains
subroutine say_hi()
print *, create_greeting("hello"), get_name("developer","fpm")
end subroutine say_hi
end module d1_m

1 change: 1 addition & 0 deletions example_packages/profiles_priorities/d11/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
8 changes: 8 additions & 0 deletions example_packages/profiles_priorities/d11/app/d11.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
program d11
use d11_m, only: create_greeting

implicit none

print *,create_greeting("hey")
end program d11

12 changes: 12 additions & 0 deletions example_packages/profiles_priorities/d11/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name = "d11"

[library]
source-dir="source"

[[executable]]
name="d11"
source-dir="app"
main="d11.f90"

[profiles.debug.gfortran.linux]
flags="-g -O2"
14 changes: 14 additions & 0 deletions example_packages/profiles_priorities/d11/source/d11_m.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module d11_m
implicit none

public :: create_greeting
contains
function create_greeting(greeting) result(created)
character(len=*), intent(in) :: greeting
character(len=:), allocatable :: created

created = greeting // " "
end function create_greeting
end module d11_m


1 change: 1 addition & 0 deletions example_packages/profiles_priorities/d12/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
9 changes: 9 additions & 0 deletions example_packages/profiles_priorities/d12/app/d12.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
program d12
use d12_m, only: get_name

implicit none

print *,get_name("developer", "fpm")
end program d12


10 changes: 10 additions & 0 deletions example_packages/profiles_priorities/d12/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name = "d12"

[library]
source-dir="source"

[[executable]]
name="d12"
source-dir="app"
main="d12.f90"

15 changes: 15 additions & 0 deletions example_packages/profiles_priorities/d12/source/d12_m.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module d12_m
implicit none

public :: get_name
contains
function get_name(name, surname) result(full_name)
character(len=*), intent(in) :: name, surname
character(len=:), allocatable :: full_name

full_name = surname // " " // name
end function get_name
end module d12_m



1 change: 1 addition & 0 deletions example_packages/profiles_priorities/d2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
8 changes: 8 additions & 0 deletions example_packages/profiles_priorities/d2/app/d2.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
program d2
use d2_m, only: count_to_ten

implicit none

call count_to_ten()
end program d2

16 changes: 16 additions & 0 deletions example_packages/profiles_priorities/d2/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = "d2"

[library]
source-dir="source"

[[executable]]
name="d2"
source-dir="app"
main="d2.f90"

[dependencies]
"d21" = {path = "../d21"}
"d22" = {path = "../d22"}



17 changes: 17 additions & 0 deletions example_packages/profiles_priorities/d2/source/d2_m.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module d2_m
use d21_m, only: count_iter
use d22_m, only: count_rec
implicit none

public :: count_to_ten
contains
subroutine count_to_ten()
print *,"This is test of counting to ten:"
print *,"Iterative version"
call count_iter(10)
print *,"Recursive version"
call count_rec(1,10)
end subroutine count_to_ten
end module d2_m


1 change: 1 addition & 0 deletions example_packages/profiles_priorities/d21/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
10 changes: 10 additions & 0 deletions example_packages/profiles_priorities/d21/app/d21.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
program d21
use d21_m, only: count_iter

implicit none

call count_iter(10)
end program d21



13 changes: 13 additions & 0 deletions example_packages/profiles_priorities/d21/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name = "d21"

[library]
source-dir="source"

[[executable]]
name="d21"
source-dir="app"
main="d21.f90"

[profiles.debug.gfortran.linux]
flags="-g -O2"

15 changes: 15 additions & 0 deletions example_packages/profiles_priorities/d21/source/d21_m.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module d21_m
implicit none

public :: count_iter
contains
subroutine count_iter(n)
integer :: n, i
do i=1,n
print *,i
end do
end subroutine count_iter
end module d21_m



1 change: 1 addition & 0 deletions example_packages/profiles_priorities/d22/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
9 changes: 9 additions & 0 deletions example_packages/profiles_priorities/d22/app/d22.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
program d22
use d22_m, only: count_rec

implicit none

call count_rec(1,10)
end program d22


10 changes: 10 additions & 0 deletions example_packages/profiles_priorities/d22/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name = "d22"

[library]
source-dir="source"

[[executable]]
name="d22"
source-dir="app"
main="d22.f90"

15 changes: 15 additions & 0 deletions example_packages/profiles_priorities/d22/source/d22_m.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module d22_m
implicit none

public :: count_rec
contains
recursive subroutine count_rec(c, n)
integer :: c,n
if (n > 0) then
print *,c
call count_rec(c+1, n-1)
end if
end subroutine count_rec
end module d22_m


Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
program main_package
use d1_m, only: say_hi
use d2_m, only: count_to_ten

call say_hi()
call count_to_ten()
end program main_package

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
d11_m.f90 -g -O2
d12_m.f90 -g -O1
d1_m.f90 -g -O1
d21_m.f90 -g -O2
d22_m.f90 -g
d2_m.f90 -g
main.f90 -g
9 changes: 9 additions & 0 deletions example_packages/profiles_priorities/main_package/fpm.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = "main_package"

[profiles.debug.gfortran.linux]
flags="-g"

[dependencies]
"d1" = {path = "../d1"}
"d2" = {path = "../d2"}

Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name = "hello_world"

[profiles.debug]
flags="-Og"

[profiles.debug.gfortran.linux]
flags="-g"

Expand Down
Loading