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

Enable profiles in toml #653

Merged

Conversation

kubajj
Copy link
Contributor

@kubajj kubajj commented Jan 25, 2022

Enable compiler profiles to be loaded into the package. Profiles are not used in any way yet. Tests in the test/fpm_test/test_manifest.f90 are making sure the functionality is behaving as expected. This is first part of #498 to be merged as it is difficult to merge such a big PR.
This is still a huge PR as the file src/fpm/manifest/profiles.f90 is a completely new file with a lot of functionality in it.

@everythingfunctional
Copy link
Member

@kubajj and I are trying to take another run at the compiler profiles, submitting PRs in smaller increments. Could one or two people please perform a review of this one?

Copy link
Member

@everythingfunctional everythingfunctional left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LKedward
Copy link
Member

LKedward commented Feb 4, 2022

Thanks @kubajj and @everythingfunctional - I'll put some time to review this this weekend.

Copy link
Member

@LKedward LKedward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jakub @kubajj! I left a few minor comments, but my main feedback is that it would be good to have some more detailed description comments for some of the more complex subroutines to describe their logic for future developers.

Also, should the changes to the manifest reference be included in this PR?

Other than that this all looks good to me and I'm happy to move forward with the rest 👍

src/fpm/manifest/profiles.f90 Outdated Show resolved Hide resolved
src/fpm/manifest/profiles.f90 Outdated Show resolved Hide resolved
src/fpm/manifest/profiles.f90 Show resolved Hide resolved
src/fpm/manifest/profiles.f90 Show resolved Hide resolved
src/fpm/manifest/profiles.f90 Show resolved Hide resolved
src/fpm/manifest/profiles.f90 Outdated Show resolved Hide resolved
src/fpm/manifest/profiles.f90 Show resolved Hide resolved
test/fpm_test/test_manifest.f90 Show resolved Hide resolved
test/fpm_test/test_manifest.f90 Show resolved Hide resolved
@@ -44,6 +46,7 @@ module fpm_manifest_package
use fpm_toml, only : toml_table, toml_array, toml_key, toml_stat, get_value, &
& len
use fpm_versioning, only : version_t, new_version
use fpm_filesystem, only: join_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is on line 345.

src/fpm/manifest/profiles.f90 Outdated Show resolved Hide resolved
Comment on lines 438 to 441
if (.not.(present(profiles).and.present(profindex))) then
call fatal_error(error, "Both profiles and profindex have to be present")
return
end if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an internal error or can it be triggered by the user? In case this is user visible (let's assume it is), how helpful would that message be for fixing the manifest?

Copy link
Contributor Author

@kubajj kubajj Feb 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an internal error. What should I do with it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if the routine cannot be called with the optional arguments absent, can't we just always require them to be present?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, the thing is, the function operates in two modes, one is for just getting to know how many profiles there are if I am correct and the other actually writes to the profiles array.
That's where the line 403 and 431 comes in with if (present(profiles_size)).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. There are 3 optional arguments. The procedure should be called with either just profiles_size present, or both profiles and profindex present. Would it make sense to split this into 2 procedures where neither has optional arguments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@everythingfunctional @awvwgk In the latest commit, I have split the function into two. One is traverse_oss_for_size the other is just traverse_oss. I tried to remove all unnecessary variables. Let me know what you think.

Comment on lines 404 to 407
if (.not.(present(profiles).and.present(profindex))) then
call fatal_error(error, "Both profiles and profindex have to be present")
return
end if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, is this a user visible and does it provide the required information to help the user fix the manifest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this is an internal error.

@kubajj
Copy link
Contributor Author

kubajj commented Feb 7, 2022

@LKedward about the changes to the manifest being included in the PR. I was thinking that since the profiles are not used yet, then we should not include it so that it does not confuse anybody.

@LKedward
Copy link
Member

LKedward commented Feb 7, 2022

@LKedward about the changes to the manifest being included in the PR. I was thinking that since the profiles are not used yet, then we should not include it so that it does not confuse anybody.

Of course, good point!

@milancurcic
Copy link
Member

This looks like it could be merged, no?

@everythingfunctional
Copy link
Member

Was there a reason this didn't get merged, or was it just forgotten about? I managed to resolve the merge conflict without much issue. Any chance we can go ahead and merge it now?

@LKedward LKedward requested a review from awvwgk September 8, 2022 18:44
Copy link
Member

@awvwgk awvwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@everythingfunctional everythingfunctional merged commit bb44917 into fortran-lang:main Sep 8, 2022
gnikit added a commit that referenced this pull request Oct 27, 2022
The original PR #653 was opened before C++ support was added.
This PR brings the profiles manifest parsing up to date.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants