-
Notifications
You must be signed in to change notification settings - Fork 111
Compiler flags profiles #498
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
Open
kubajj
wants to merge
38
commits into
fortran-lang:main
Choose a base branch
from
kubajj:Load_compiler_profiles
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 22 commits
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 a978be3
Add support for profiles defined with missing values
kubajj 648764c
Add first implementation of find_profile subroutine
kubajj e8ea449
Temporary solution of adding compiler flags from profile to model
kubajj 020c34a
Added built in profiles support, updated find_profile decision making
kubajj 1caa897
Add error handling and basic testing for profiles
kubajj 97085c6
Fix merge conflict
kubajj 507d634
Simplify profiles handling before implementing package scope
kubajj 5550bf7
Initial implementation of package scope compiler profiles
kubajj 941c23b
Add file scope flags and representation of profiles as string for sho…
kubajj a1a503c
Change _ to - in toml fields names, minor changes in get_flags subrou…
kubajj f81132a
Merge pull requests
kubajj 2989997
Add example pacakges with compiler profiles, remove c_flags from srcf…
kubajj 709ad3a
Add an example project with c flags
kubajj 0997172
Stop modifying model outside of build_model
kubajj cb06c00
Fix src/fpm_targets.f90 to run with no source files
kubajj cab4181
Fix merge conflicts
kubajj 286ac9c
Remove failing line from fpm_targets.f90
kubajj 98badd6
Update error handling in profiles parser and introduce is_built_in bo…
kubajj 7d8ca4c
Add profiles hierarchy and propagation to dependencies
kubajj 999c3a6
Implement suggested changes
kubajj 981df56
Update ci test for windows
kubajj 1e82f4e
Update profiles priorities test to use proprocessor
kubajj 20084fe
Apply suggestions from code review
kubajj 91323bf
Change stop to stop 1 in profiles_priorities example package
kubajj 269416a
Prevent main package in profiles priorities from failing due to not b…
kubajj ba2c812
Fix merge conflict
kubajj ce59082
Add comments detailing the functions
kubajj 789d823
Fox merge conflict with PR #533
kubajj 794cd85
Apply suggestions from code review
kubajj a3978b8
Make new_dependency_node pure
kubajj e642a14
Make get_default_profiles neater
kubajj 09e5b97
Apply some suggestions from code review
kubajj 7d09b4f
Extend subroutine get_object_name
kubajj 789175f
Merge branch 'Load_compiler_profiles' of github.com:kubajj/fpm into L…
kubajj d708b94
Close code fence and propagate error while reading manifest
kubajj fa52c0a
Cover invalid toml - only supported tables and fields are valid
kubajj 1edf2f1
Last GSoC commit - Separate validation and reading when parsing toml …
kubajj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 @@ | ||
build/* |
This file contains hidden or 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 @@ | ||
program d1 | ||
use d1_m, only: say_hi | ||
|
||
implicit none | ||
|
||
call say_hi() | ||
end program d1 |
This file contains hidden or 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,21 @@ | ||
name = "d1" | ||
|
||
[library] | ||
source-dir="source" | ||
|
||
[[executable]] | ||
name="d1" | ||
source-dir="app" | ||
main="d1.f90" | ||
|
||
[profiles.debug.gfortran] | ||
flags="-g -O1" | ||
|
||
[profiles.debug.gfortran.windows] | ||
flags="/g /O1" | ||
|
||
[dependencies] | ||
"d11" = {path = "../d11"} | ||
"d12" = {path = "../d12"} | ||
awvwgk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
This file contains hidden or 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,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 | ||
|
This file contains hidden or 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 @@ | ||
build/* |
This file contains hidden or 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,8 @@ | ||
program d11 | ||
use d11_m, only: create_greeting | ||
|
||
implicit none | ||
|
||
print *,create_greeting("hey") | ||
end program d11 | ||
|
This file contains hidden or 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,15 @@ | ||
name = "d11" | ||
|
||
[library] | ||
source-dir="source" | ||
|
||
[[executable]] | ||
name="d11" | ||
source-dir="app" | ||
main="d11.f90" | ||
|
||
[profiles.debug.gfortran] | ||
flags="-g -O2" | ||
|
||
[profiles.debug.gfortran.windows] | ||
flags="/g /O2" |
This file contains hidden or 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 @@ | ||
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 | ||
|
||
|
This file contains hidden or 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 @@ | ||
build/* |
This file contains hidden or 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,9 @@ | ||
program d12 | ||
use d12_m, only: get_name | ||
|
||
implicit none | ||
|
||
print *,get_name("developer", "fpm") | ||
end program d12 | ||
|
||
|
This file contains hidden or 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,10 @@ | ||
name = "d12" | ||
|
||
[library] | ||
source-dir="source" | ||
|
||
[[executable]] | ||
name="d12" | ||
source-dir="app" | ||
main="d12.f90" | ||
|
This file contains hidden or 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,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 | ||
|
||
|
||
|
This file contains hidden or 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 @@ | ||
build/* |
This file contains hidden or 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,8 @@ | ||
program d2 | ||
use d2_m, only: count_to_ten | ||
|
||
implicit none | ||
|
||
call count_to_ten() | ||
end program d2 | ||
|
This file contains hidden or 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,16 @@ | ||
name = "d2" | ||
|
||
[library] | ||
source-dir="source" | ||
|
||
[[executable]] | ||
name="d2" | ||
source-dir="app" | ||
main="d2.f90" | ||
|
||
[dependencies] | ||
"d21" = {path = "../d21"} | ||
"d22" = {path = "../d22"} | ||
|
||
|
||
|
This file contains hidden or 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,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 | ||
|
||
|
This file contains hidden or 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 @@ | ||
build/* |
This file contains hidden or 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,10 @@ | ||
program d21 | ||
use d21_m, only: count_iter | ||
|
||
implicit none | ||
|
||
call count_iter(10) | ||
end program d21 | ||
|
||
|
||
|
This file contains hidden or 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,16 @@ | ||
name = "d21" | ||
|
||
[library] | ||
source-dir="source" | ||
|
||
[[executable]] | ||
name="d21" | ||
source-dir="app" | ||
main="d21.f90" | ||
|
||
[profiles.debug.gfortran] | ||
flags="-g -O2" | ||
|
||
[profiles.debug.gfortran.windows] | ||
flags="/g /O2" | ||
|
This file contains hidden or 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,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 | ||
|
||
|
||
|
This file contains hidden or 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 @@ | ||
build/* |
This file contains hidden or 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,9 @@ | ||
program d22 | ||
use d22_m, only: count_rec | ||
|
||
implicit none | ||
|
||
call count_rec(1,10) | ||
end program d22 | ||
|
||
|
This file contains hidden or 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,10 @@ | ||
name = "d22" | ||
|
||
[library] | ||
source-dir="source" | ||
|
||
[[executable]] | ||
name="d22" | ||
source-dir="app" | ||
main="d22.f90" | ||
|
This file contains hidden or 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,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 | ||
|
||
|
This file contains hidden or 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 @@ | ||
build/* |
8 changes: 8 additions & 0 deletions
8
example_packages/profiles_priorities/main_package/app/main.f90
This file contains hidden or 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,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 | ||
|
7 changes: 7 additions & 0 deletions
7
example_packages/profiles_priorities/main_package/correct_log.txt
This file contains hidden or 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 @@ | ||
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 |
12 changes: 12 additions & 0 deletions
12
example_packages/profiles_priorities/main_package/fpm.toml
This file contains hidden or 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,12 @@ | ||
name = "main_package" | ||
|
||
[profiles.debug.gfortran] | ||
flags="-g" | ||
|
||
[profiles.debug.gfortran.windows] | ||
flags="/g" | ||
|
||
[dependencies] | ||
"d1" = {path = "../d1"} | ||
"d2" = {path = "../d2"} | ||
|
This file contains hidden or 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 @@ | ||
d11_m.f90 -g -O2 | ||
d12_m.f90 -g -O1 | ||
d21_m.f90 -g -O2 | ||
d22_m.f90 -g | ||
d1_m.f90 -g -O1 | ||
d2_m.f90 -g | ||
main.f90 -g |
This file contains hidden or 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 @@ | ||
build/* |
This file contains hidden or 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,10 @@ | ||
program with_c_app | ||
use with_c | ||
implicit none | ||
|
||
write(*,*) "isdir('app') = ", system_isdir('app') | ||
write(*,*) "isdir('src') = ", system_isdir('src') | ||
write(*,*) "isdir('test') = ", system_isdir('test') | ||
write(*,*) "isdir('bench') = ", system_isdir('bench') | ||
|
||
end program with_c_app |
This file contains hidden or 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,4 @@ | ||
name = "with_c" | ||
|
||
[profiles.debug.gfortran.linux] | ||
c-flags="-O1 -g" |
This file contains hidden or 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,10 @@ | ||
#include <sys/stat.h> | ||
/* | ||
* Decides whether a given file name is a directory. | ||
* return 1 if file exists and is a directory | ||
* Source (Public domain): https://github.com/urbanjost/M_system | ||
*/ | ||
int my_isdir (const char *path) { | ||
struct stat sb; | ||
return stat(path, &sb) == 0 && S_ISDIR (sb.st_mode); | ||
} |
This file contains hidden or 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,26 @@ | ||
module with_c | ||
use iso_c_binding, only: c_char, c_int, c_null_char | ||
implicit none | ||
|
||
contains | ||
|
||
function system_isdir(dirname) | ||
! Source (Public domain): https://github.com/urbanjost/M_system | ||
! | ||
implicit none | ||
character(len=*),intent(in) :: dirname | ||
logical :: system_isdir | ||
|
||
interface | ||
function c_isdir(dirname) bind (C,name="my_isdir") result (c_ierr) | ||
import c_char,c_int | ||
character(kind=c_char,len=1),intent(in) :: dirname(*) | ||
integer(kind=c_int) :: c_ierr | ||
end function c_isdir | ||
end interface | ||
|
||
system_isdir= c_isdir(trim(dirname)//c_null_char) == 1 | ||
|
||
end function system_isdir | ||
|
||
end module with_c |
This file contains hidden or 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 @@ | ||
build/* |
This file contains hidden or 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,3 @@ | ||
program hello_world | ||
print *, "Hello, World!" | ||
end program hello_world |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.