Richard Darst
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Data analysis workflows in R and Python - Day 3 ## Links - **Welcome!** Please open this HackMD and the course material!: https://hackmd.io/@rkdarst/data-workflows - Course page: https://scicomp.aalto.fi/training/scip/data-analysis/ - Lesson material: https://aaltoscicomp.github.io/data-analysis-workflows-course/ - Presemo for polls: https://presemo.aalto.fi/dataanalysis - HackMD from previous days: https://hackmd.io/k2aUQc2xT2mEUeQMDJHfdg?view ----- ## Download up-to-date lesson materials using these instructions - Download [this notebook](https://raw.githubusercontent.com/AaltoSciComp/data-analysis-workflows-course/master/download_lessons.ipynb) (right click -> save link as) and save it to the course directory (`data-analysis-workflows-course`) - Run the notebook - It will download up-to-date lesson materials - If you get an error that says it's not being run from the course folder, please give `path_to_course_folder=../relativce/path/to/my/course/folder` as an additional argument `download_lessons('lesson 4', path_to_course_folder='../relativce/path/to/my/course/folder')` - If for some reason it does not work, you can use the following links to download the notebooks: **Lecture notebooks (right click -> save)**: [ch4-python-lecture.ipynb](https://raw.githubusercontent.com/AaltoSciComp/data-analysis-workflows-course/master/python_exercises/ch4-python-lecture.ipynb) [ch4-r-lecture.ipynb](https://raw.githubusercontent.com/AaltoSciComp/data-analysis-workflows-course/master/r_exercises/ch4-r-lecture.ipynb) **Exercise notebooks (right click -> save)**: No exercises today. ## Icebreaker Do you offload some of your computations to other machines or do you manage with your desktop/laptop? Do you use CSC / local cluster / cloud? Are you planning on using them? What is the biggest problem that prevents you from using these resources? - I do most of computations on (NIRD) HPC and then transfer them to my machine. I face no problems in specific, but sometimes I feel if more tools were available on HPC (but that's just out of laziness) - My amount of data is too big and the laptop too slow. It is done on a cluster. I guess it would be hard to break down the data into pieces and load it in smaller chunks on the laptop. It is a memory questions? - Its been good, makes me understand how the dataanalyis works. I am new in this field. - I do run the model on HPC (Saga), then I do the post processing on NIRD, what I find the most frustrating with using HPC is mostly the lack of interactive tools, like jupyterlab. - I have used local cluster due to too long computation time on my own laptop. No experience in CSC. ## Going over exercises ## Scaling - I just looking only at Simo's screen. What is the definition of a node, please? - A cluster is made up of many computers, and we call each one a node. Node=one box with CPU, memory, network, etc. Node contains CPUs which contain cores which can contain threads... - - - Is the RAM consumption for the OS negligible? - Yes! - Unless you're running Windows Millenium Edition LOL :) - I think people tend to forget they have to allocate memory for the OS. I don't know how hungry is Linux? - Relevant: RAM comparisons by linux distro https://www.reddit.com/r/linux/comments/5l39tz/linux_distros_ram_consumption_comparison_updated/ Seems like Debian is a winner. On HPC clusters however, only the processes started by the job are kept into account for the RAM requirements. I am not an OS expert, but in a normal single machine settings (e.g. your laptop) if you request more than you have, they start switching to disk (and things get slow). - This is called swapping and you should avoid it at all cost. It is very slow. - I have never heard about garbage collector or seen it. Do people often use it? - Usually Python/R other languages are pretty clever about garbage collection already (Python runs it periodically). Only in certain cases do you need to worry about it. - Python codes that often use objects, functions, and other structures such as these which make it easy for the garbage collector to operate. Data analysis workflows are however often written as huge scripts with no complex structures (function call here and there of course). Thus it is very easy to end up in a situation where the garbage collector doesn't run on your variables. If you run stuff on your interpreter (Python/ipython/Jupyter/R/Rstudio) you by default will store stuff to the global scope and the garbage collector won't touch them unless you explicitly overwrite or delete these variables. [name=simo] - To avoid random reads, should you always concatenate the datafiles into one file before you do your analysis? Is there situation where it is better to keep it in seperate files? - Hm, one file is usually better, if you have a format where you can easily randomly seek to the area you need - In HPC contexts, the speed of the disk where the data are stored also starts to make a difference. For example computing nodes have a local disk, it is much better to move files temporarly to the local disk rather than doing random reads from files stored on a distributed system. - - Could I ask what is a random read? What is the application? - Random access (or direct access) is a method to read from a file without going through all the content of the file. - In this context it also means something that the file system sees as a "random" thing. So when reading huge number of small files the filesystem has to look up how owns the file, open up the file, give the data etc. for each file. It cannot do any assumptions what you're going to do next. If you're reading a file sequentially (give me more of what I had previously), the file system can give the answer much faster.[name=simo] - number of threads is same as number of partition? - It's like number of processes that are running in parallel. But Simo can expand on threads vs processes. - - ## Feedback Please say one good thing and one thing to be improved about today and/or about the whole course: - It's hard to stay focused on a 3h lecture without exercises - This lecture was super helpful !! (at least for me) thanks - This course was very helpful for me. Thank you for organizing all the materials. Thanks! - - The potential of having it as remote lecture is super. - I think we could have more breaks and need them. Simo talked sometimes for very long. Is it maybe better to give one course for R and one course for Python? Why switching in between all the time? - Maybe show other examples than only from/with Pandas library? - How long are the videos after the course available? I thought they disappear on Twitch after 2 weeks? Okay, I did not know you put them on youtube. Nice. Upcoming courses: - CodeRefinery: https://coderefinery.github.io/2020-10-20-online/ - Matlab Basics: https://scicomp.aalto.fi/training/scip/matlab-basics/ - - --- *always ask questions right above this line*

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully