becoming a krome developerkromepackage.org/bootcamp/2014/talks/19_09_2014.pdf · 7 bitbucket and...
TRANSCRIPT
Becoming a KROME developerand more...
September 19, 2014
Stefano BovinoKROME school 2014
Historische Sternwarte-Göttingen
Institute for AstrophysicsGeorg-August Universität Göttingen
Germany
1News from the world
People happy because of the last KROME release!?
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
2News from the world
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
3
First: a quick summaryon how to include KROME in your simulations
which microphysics?
includedin
KROME?
join the dev
luckyenough?
run KROME
obtain acompact file
x(:),Tgas,hydro_dt
no
yes
no
yes
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
4
Simple scheme of an hydro codewhere to include KROME
e-
OPAC I T Y
T
A+B C+Dk(T)
A
COOLING
ad
HYDRO
DUST
E
F J
I
HG
RAD+CR
HEATING
nH nH2
nH+ nenHCO
B
DC
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
5
First: a quick summaryon how to include KROME in your simulations
I enable options you needI run KROME
I inlcude the krome modulesI use kromeI use krome_user
I call krome_init()I once and for all
I be sure to have initialized thespecies (make use of krome_nmolsand other common arrays)
I change your Makefile accordinglyI solver files (opkd*.F)I krome routine (krome_all)
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
6
Bitbucket and KROMEa happy marriage
KROME is developed and maintained on Bitbucket
What is bitbucket?Bitbucket is a web-based hosting service for projects that usedistributed version control system (DVCS)
I GitI Mercurial
Main advantagesI it is not a centralized system (there is no central server)I it is a peer-to-peer networkI you can work without being connected to a network
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
7
Bitbucket and KROMEa happy marriage
To be part of the Bitbucket community you needI to register and create an accountI create your own repository (project) or start to follow an existing
repoI learn the basics of git
I git cloneI git addI git statusI git commitI git pushI git pull
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
8Follow a repository
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
9Git clone
I the most common way for users to obtain a development copyI makes a copy of an existing repository into your machine
basic usage$ git clone <repo>$ git clone <repo> <directory>
I once cloned everything is managed through your local repository.
I a central repo does not existI push or pull commits from
one repository to another
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
10Git clone
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
11
Git cloneoutput
$ git clone https://bitbucket.org/tgrassi/krome.gitCloning into ’krome’...remote: Counting objects: 4193, done.remote: Compressing objects: 100% (2063/2063), done.remote: Total 4193 (delta 2675), reused 3278 (delta 2094)Receiving objects: 100% (4193/4193), 16.81 MiB | 673.00 KiB/s, done.Resolving deltas: 100% (2675/2675), done.Checking connectivity... done.
I you will generate a folder named "krome"I note that you’re downloading the "dev" version
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
12
Git push and Git pullsharing the code
I once cloned the users can start to modify their local repositoryI Git is designed to give each developer an entirely isolated
development environment.I users typically need to share a series of commits (modifications)
before to push any modificationsPlease commit your modifications ("git commit -m "comment")Please update your repository
$ git pull origin
I it’s an easy way to synchronize your local repository withupstream changes
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
13
Pulling processupdate the code
I master → local branch/repoI origin/master → remote repo
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
14
Git pushPush your modification
Now that you are in line with the remote repo you can "push" yourmodifications.
I This has the potential to overwrite changes, so you need to becareful how you use it.
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
15
Git pushbasic steps
1. you prepared your modifications2. you updated to the latest version of the remote repo3. you are ready to push your commits
$ git add .$ git status$ git commit -m "name_of_the_commit"$ git push origin master
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
16
Become a KROME developerwe need help!
KROME is centralized
Centralized Workflow uses a central repository to serve as the singlepoint-of-entry for all changes to the project.
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
17
Become a KROME developerwe need help!
1. create a branch or fork the KROME repo2. a branch represents an independent line of development3. branches serve as an abstraction for the edit/stage/commit
process discussed in Git Basics
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
18
Create a branchdevelopment
I once created the branch, clone itI then you can modify the code
(python and fortran)I push your commits
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
19
Fork the central repodevelopment
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
20Fork or branch?
BranchesI remain part of the original repositoryI the branch knows and relies on the main code (and viceversa)
ForkI it means a copy of the original codeI is independent from the original repositoryI if the original repository is deleted, the fork remains
In KROME we suggest to fork the central repository
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
21
Pull requestdev process
I Now you have your own branch/fork with new featuresI To add your modifications to the central repo (KROME) you need
to create a "pull request"I pull requests are a mechanism for a developer to notify team
members that they have completed a featureI everybody involved know that they need to review the code and
merge it into the master branch
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
22
Become a KROME developera clear example step by step
1. fork or create a branch of theKROME main repo
2. clone your own repo wit "gitclone"
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
22
Become a KROME developer (cont’d)a clear example step by step
3. modify KROME adding yourfeatures
4. push your commits on yourremote branch("git commit"& "git push")
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
22
Become a KROME developer (cont’d)a clear example step by step
5. create a pull request to KROME
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
22
Become a KROME developer (cont’d)a clear example step by step
6. the community will see andreview your request
if you prepare a nice featureafter the review process the feautre can be included or not in theoriginal KROME repo → i.e. become part of the package
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
23
Become a KROME developerrequirements
to become a KROME developerI know fortran and/or pythonI be motivatedI have the good attitude to share code
how you can contributeI preparing fortran functions/subroutinesI carefully modify the heart of KROME, i.e. the python
pre-processorI simply create or discuss issues
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
24What should be clear at this stage
I KROME is a package which help users to build their ownmicrophysics
I KROME is open sourceI KROME is a pre-processorI a chemical network is compulsory to run KROME
I KROME is flexible and can be customizedI KROME allow users to choose between efficiency and accuracyI to embed KROME into an external code requires a simple call
I call krome(x(:), Tgas, dt)I BUT there are caveats
I the community is very important!I KROME saves your days (as Tommaso stated)
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
25What we learned
I how to prepare a chemical networkI the use of some tokens
I @format→ to change the format in the network fileI @common→ to add a common variableI @var→ to define variables in the network fileI @CR_begin/@CR_stop→ to define block of CR recationsI @photo_begin/@photo_stop→ to define block of
photo-recationsI @cooling_start, @cooling_stop, and @cooling
I how to run KROME and the pre-built testsI how to call KROME from a framework codeI how to use the krome_user module
I how to initialize common variablesI how to initialize and rescale a radiation spectrum
I some of the KROME flagsI -n, -useN, -pedantic, -noExample, -cooling=H2,CI, -heating=CR,
-PhotoBinsStefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
26Acknowledgements
Invited speakersI Daniele GalliI Troels HaugboelleI Muhammad LatifI Dominik SchleicherI Daniel SeifriedI Svitlana Zhukovska
"you gotthe weight on your shouldersThat’s breaking your back."
Participants! Users is always the best source of improvement!I for your curiosity on the packageI for the nice and fruitful discussionsI for the nice (and hard) time during the practical sessions
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
27
Urgent developmentanyone interested?
I the solver is the most important part of the packageI low-order and simple solver only useful for very small network
and a few physical cases (as discussed by Dominik)I accurate but efficient → not too computational expansiveI for a good solver
I capability to work with stiff problemsI high-enough and variable orderI good definition of the time-stepI and a variable time-stepI computational optimization (e.g. on the matrix inversions)I accurate evaluation of the Jacobian matrix
(in particular temperature, as mentioned by Tommaso)I now in KROME the well-established DLOSDES solver
I accurate and stableI time-step and order variableI not so efficient but still fast (extensively proved by Troels)I not very well optimizedI very general (for a broad range of problems)
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
28Urgent development
Anyone interested in developing a new solver with theabove features?
“First, solve the problem. Then, write the code.”- John Johnson -
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
29
Where are you?the picture will be available online
Stefano Bovino KROME school 2014 Historische Sternwarte-Göttingen | Becoming a KROME developer
Thank you for your attention!