Enrico Glerean
    • 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 New
    • 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 Note Insights Versions and GitHub Sync 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # CHAT: Matlab advanced May 2021 ## Asynchronous chat for the course Course material at https://hackmd.io/@eglerean/MatlabAdvanced2021 # Day 1 :::spoiler ## Icebreaker 1 ***What are your learning goals for this course?*** - answer here - Learn efficient and flexible coding and useful tricks, especially dealing with large datasets - Know how to solve problems that I encounter during the next few days and learn as many tricks as possible - Writing efficient code and any speedup tricks, dealing with memory issues, parallelization - Learn something interesting and useful about parallel computing and other techniques useful for large problems - I will be using machine learning in my thesis; so it is a subject of interest for me in MATLAB. Other numerical calculations will also be useful for me in matlab. - I study Machine learning but i am mostly working with python and its time to learn how ML works in MATLAB. :+1: - I want to learn how others are using matlab these days, explore new things on machine learning with matlab, how to improve this course for the future years - I want to learn more advanced matlab techniques, for example: visualizations. - I want to learn advanced MATLAB techniques and how to draw beautiful plots - I want to learn good tricks with MATLAB (parallel computing and refinibg my skills) - GPU computing and parallel computing in MATLAB - I want to generally improve my Matlab skills and general competence, signal processing would be great as I work with audio ---- - I want to improve the performance of my code and speed of computations, I'll work on numerical simulations in physical optics, it requires too much resources, so I'd like to somehow improve it - Learn how to use MatLab for Reinforcement Learning - That's great. Need to make it more advance. Thanks. - ## Icebreaker 2 ***What type of data do you work with? How big is an average dataset (size as in disk space, and also size as dimensions of the data themselves)?*** - I work with functional brain images, stored as 4 dimensional volumes of 91x109x91x1000 (last number varies), usually about 3GB per data file - I work with simulated channel information obtained from simulators, files can be in order of GB, sometimes 10GB or more. - I work with artificially or random generated matrices to test conjectures in linear algebra, usually related to asymptotic properties, meaning on very large matrices (it would be nice to get to 1Mx1M). - I think I will be working with data from solid-state systems and quantum simulations. Data-size hopefully large :) - Probably in the range of a few GB for machine learning. - I work with EEG data, up to 128x6M and 6GB in size. Usually the data size is smaller though, maybe around 1GB. - I work with data from experiments and numerical simulations, usually calculate something from several 2D arrays and/or combine it - I work with EEG-fMRI, TMS-EEG and EEG datasets. Typically EEG datasets are 64xVeryBigNumber / 7Gb with sampling rate of 20kHz. - Rather large data (90GB in total), mostly structural MRI but also fMRI - Audio, generally 2 channel stereo so 2 columns and many rows.small file sizes comparatively - I work with simulation data mostly. Usually the datasets have been few gigabytes at most, but I wouldn't mind using bigger datasets if I had the right tools for it. # Anonymous(*) questions and comments *Anything that comes to your mind, write here below* *(\*) Anonymous IFF you are not logged in hackmd or authorised other services (e.g. github): use private browswing if you are unsure* - write a question like this - When I enter my password into triton, I have the message *permission denied*. Does it mean that the password is wrong, or is it something else - a reply from Enrico or from anybody else - another one here like this - and another .... - Comment to the above - Comment to the comment - ... ## Exercise 1.1 - what was the command to connect to triton with graphics - `ssh -X triton.aalto.fi` - Where can we see the exercise? I couldn't find the link - https://hackmd.io/QGR0U7yYTw6P4lxdQPCkyQ?view#Exercise-11-matlab-workflows - How did we start the interactive session in triton? - command `sinteractive` - How to specify the RAM, GPU and etc by interactive? - `sinteractive -c=4 --mem=4G -p batch - Where can I found the maximum available resources? - https://scicomp.aalto.fi/triton/ref/#partitions - Is there any time limitation?` - See link before - write here what you got when running the exercise, for example: - ROOM 57: we got "/Users/enrico" as path, etc - Room 4: 0.8147, 9.10.1602886 (R2021a), /m/home/home6/66/USERNAME/unix, same number, 8.3.0.532 (R2014a), home/USERNAME - Room 3: 0.8147, 9.10.0.1602886(R2021a) - >> rng(0); rand ans = 0.8147 >> version ans = '9.10.0.1602886 (R2021a)' >> pwd ans = '/m/home/home8/81/rezapop1/unix' ## Questions and comments here below - What is the command to open matlab in konsole - just type `matlab` in the terminal window I get command not recognized in triton i think - you need to first run `module load matlab` on triton ## Exercise 1.2 (13 minutes) - Link to exercise in the usual main webpage: https://hackmd.io/QGR0U7yYTw6P4lxdQPCkyQ?view#Exercise-12-working-with-big-mat-files Write here if you are blocked - VDI doesn't have copy-paste, so it's difficult to even get to the drive where bigdata is - Copy paste should work, we can check later why it doesnt, however if you open firefox or chrome on VDI you can find the email I sent and click the link from there, it is the main course webpage - Copy-paste doesn't work from one personal pc to the session on vdi.aalto.fi https://hackmd.io/@eglerean/MatlabAdvanced2021 - How to change my directory to google drive to read big data? - You should have an option to download it. Put the mouse on top of the file "bigdata.zip" and there is an arrow to download it - Is there any way to load it from Google drive without downloading it? - No it is not possible as far as I know - How to load my data(bigdata.mat after downloading) into triton from my laptop? - I will make it available on a triton shared folder - Do our code and data are secure in triton or others with Aalto account can access them (I mean each time we need to transfer them to our personal laptop)? - if you are familiar with linux permissions, then those who you give access to will have access. Which means that if you make your files readable and writable only by you, then nobody else will have access. It is actually safer to have file stored in a remote system with correct permissions, rather than on your laptop assuming somebody could steal it and get the sensitive data/code. - I've passed 3 or 4 online courses at mathworks website before. Can I include it in my study plan and get credits? - I guess :) unless other course participants object since somebody might consider it unfair. Let's discuss the matter in private. - ROOM 123: we got this result - ROOM 3: 1007 variables, the only one with the required properties is 'xifkmjsrbiwtjhfy', 708x708, mean = -0.0021 -jj = 'xifkmjsrbiwtjhfy' - I used "getfield" function - :+1: - I used `x = load('bigdata.mat','x*y')` - :+1: ## Exercise 1.3 Let's get in touch before 14:40 to see if people need more time. - When and where the recorded video file of today's section is available? # Feedback for today *Write one positive thing and one thing that can be improved. Please let us know if the hands-on coding approach is working for you, or if you'd rather have more theory/lecture* - Enrico: the access to the demo data can be improved + considerations for those who might not have enough internet speed or disk space - The hands-on method is good in my opinion, but for the last task, there could've been a bit more theory. - I like the hands-on coding. However, a bit more time would have been good - Coding myself works well! However, there could be more hints. For example, the use of 'x*y' in ex. 1.2 could have helped :) Nonetheless, now I know. - The exercises are useful, but if we can have an example first and then do a similar exercise, and it might help us get into the situation faster. - The exercises are interesting, but I feel like I spend most of the time trying to figure out how to do string manipulation in matlab or some other fairly trivial stuff that I don't normally use. Some hints could make that part faster. - The hands-on coding approach was good! Maybe more hints would have been useful - I understand the topics and many of those are familiar for me. Meanwhile, I do not have enough time for writing the code, unfortunately :-) ::: ## Exercise 1.4 - So memmapfile command is returning a pointer to the structured data? # Day 2 :::spoiler ## Icebreaker: if you know it, what takes longer to run in your usual matlab computations? - It takes very long to do bootstrap permutation and other permutation based statistical tests - I do not know what takes longer... - Load big .mat files and for loops with matrix multiplication - Large number of for-loops - Linear algebra with big arrays - nested for loops.. - I don't know which parts take longest - Operations of big matrices - FFT and inverseFFT filterbanks. - Not sure really - The size of data ## Exercise, write a better Pearson's correlation :::warning **EXERCISE until 13:35ish**. Start from the code at https://hackmd.io/QGR0U7yYTw6P4lxdQPCkyQ?view#Exercise-write-a-better-Pearson%E2%80%99s-corrlation ::: In this way we can perform faster than MATLAB corr function: :::spoiler tic mx=mean(x); my=mean(y); sx=std(x); sy=std(y); Mx= repmat(mx,length(x),1); My= repmat(my,length(y),1); tempr=(x - Mx).*(y -My)/(sx*sy); rr=sum(tempr)/(length(tempr)-1) myy_correlation_time=toc ::: - Hide your code while others are having fun :) - Woohoo, 8e-4 seconds check this below :::spoiler ``` zx = x - mean(x); zy = y - mean(y); % in std it computes the mean, but we already % have that, so we can use it instead of % computing it again sx = norm(zx); sy = norm(zy); if(sx == 0 || sy == 0) error('we cannot divide by zero') end % dividing sx*sy here is more efficient than % to divide every component of a vector r=zx'*zy/(length(tempr)-1)/(sx*sy); ``` ::: :::spoiler mx=mean(x); my=mean(y); sx=std(x); sy=std(y); if(sx == 0 || sy == 0) error('we cannot divide by zero') end r = (x-mx)'*(y-my)/(sx*sy)/1e4; ::: ## Questions, comments, etc... here below - I prefer using python to draw figures, but Matlab is simpler for me to calculate/process the data. Is it a good idea to use python scripts inside Matlab? - I try to avoid mixing more than one language into the same "processing step" - I like to work with python especially because of jupyter notebook / jupyterlab (it's easy to document also big project). Is there something similar for Matlab? - I think matlab livescript is pretty similar to jupyter notebook (maybe I'm wrong-I'm not an expert XD) ; upd: if I choose 'output inline mode' instead 'output on right' in Live Editor, I don't feel the difference. - I don't agree. Jupyter is much nicer to read. It looks nearly like a word document - What do you think of Octave? - I havent really used it much, but I know of people who have struggled to make matlab code compatible with Octabe beyond simple operations. - How can we access your recording? - yes I will share what I recorded - What about home assignments? upd: I've finished all onramp courses, I think it's a good motivation to start an advanced course :-) - please pick a longer course and be fair and do 6 hours of it - Do you do a Python course? - https://aaltoscicomp.github.io/python-for-scicomp/ - what would you recommend for symbolic math computations? I know that Matlab and Python both support it - No idea :) - If any of you knows better, please comment - I have used Mathematica recently for symbolic computations, I liked it better than matlab for this. ## Feedback for the day Write something positive and someting that can be improved. I thought it was better today, the breakout rooms tend to be a bit quiet -I liked the speed today -I love today's pace. -I'm a slowpoke, so today's format is more preferrable for me I agree with this as well^^^ - today is very good. -tpdayaa - I quite liked the pacing for the lecture today, as well as the exercises. # Day 3 ## Question: when is it good for you to have the 4th lecture (about graphics/figures)? Options could be tue or wed 12-15 - This time next week works for me 12-15 - I cannot join but I'll check the MATLAB page for parallel computing etc. -Tuesday next week same time works. - Tuesday +1 - Next week, either day would work WEdnesday would be better for me - Next week would be nice - For me, next week works only on Wednesday, not on Tuesday **Let's do our last session next wednesday at 12:00** ## Questions or comments, write here below - what is the deadline for sending the certificates? - Ideally within the 1st week of June (e.g. before Monday 7th June) - Where we can find the recorded video files? - I will upload and share with all people registered - I've almost finished "Programming techniques". It's quite beneficial, but hard! - :+1: - can we use the parallelization in Matlab Online? - I am not sure, if anyone wants to try please be my guest :) - upd. I checked, "no clusters were found" :( - The login node seems to be an easy error to do. Is it usual that somebody uses the login node and how big of a problem that is for everyone else? - Matlab Online is fine when you need to check something for your submitted paper during a vacation :-D - :+1: :) 'parpool' requires Parallel Computing Toolbox.Installing now - 1 worker on Triton, 2 on VDI - I have 2 workers - 4 workers - 4 workers :) - 2 workers - 2 workers - 2 - I seem to have destroyed my matlab install after yesterday :) - 18 workers in my workstation -8 ### hostname on triton - csl38.int.triton.aalto.fi - csl43.int.triton.aalto.fi - csl25 - I got csl48.int.triton.aalto.fi - csl47.int.triton.aalto.fi - csl11 - csl25.int.triton.aalto.fi - How do you login twice to the node, in order to check what's happening? - just ssh the node from the login, for example "ssh csl3" - I write ssh cs148.int.triton.aalto.fi, have this: ssh: Could not resolve hostname cs148.int.triton.aalto.fi: Name or service not known - You first connect to triton with ssh triton.aalto.fi and then ssh to the node ssh csl48 (just csl48)(also it's an l not a 1) - I can demo-it again after the break - it works, thanks - I tried to ssh into my node to run top using ssh csl125 for example, but it denies my password. Is it again an issue with the keyboard like we saw in the VDI login? - You can change your keyboard layout from the top right corner of the vdi - I am using putty in my personal machine,not vdi. - Probably not a keyboard layout issue then. Did you ssh into the node from the triton login? - Yes. I did. I have terminal open in triton csl node but trying to ssh into that same node from other terminal is the problem. - Using that other terminal, first ssh into triton and then ssh into the node from the triton login - is 'matlab_multithread' a shorthand for a longer command? - How can we set sbatch time to be several days? Sometimes I need to run matlab days. - "--time=5-00:00:00" - When I have to run the same command on multiple datasets using Matlab on Triton, do you have any suggestions where to put the data files best? Or does it not matter where they are? : - Is the moving sum possible with communicating parallellisation (spmd(?) and pareval) - can we somehow connect to both Matlab and Triton fully from a web browser? - What are the limitations of GPU calculations? ### Feedback for the day Write something good and something that could be improved. Write also your wishes for the last session which will be next Wednsday at 12:00 - I liked this approach rather than coding along, because I feel like it is easier to see the overview of the workflow first and then try yourself.+1 Especially, when there are many terminal windows and Triton nodes involved :) - I found it really useful to learn how these things can be done on triton. With such limited time, it would be difficult to find time for both hands on coding and listening to the lecture. - - today the explanations were really clear! Other topics to cover: more GPUs in MATLAB, and maybe spmd and other parallelization tools. - today I learned a lot of things that I will probably use many, many times. So it was a really good lesson today! - I prefer today's way of the lecture, I would probably like the video of the lecture available soon so I can try out some of the things from the lecture. - Today very comfortable. Next Wednesday, very interested in the distributed computation in Matlab. Also, advanced figure manipulation techniques are very appreciated. - It is good that you write the code and explain. After that, we can try to copy the code. IMO this works best for the fast-paced learning -I'd like to see signal processing in the next lecture if possible Wanna migrate your code to triton to parallelize it? Contact us https://scicomp.aalto.fi/rse/ (you must be doing research, no students sorry) # Day 4... Graphics! *as usual write here below about questions, comments, etc* - is there any difference when we use '' instead "" in plot specifications? - Isn't one char array? - https://se.mathworks.com/help/matlab/characters-and-strings.html - https://se.mathworks.com/help/matlab/matlab_prog/frequently-asked-questions-about-string-arrays.html - what is the difference between 'tiled layout' and 'subplot'? - It's a new thing! See at the bottom https://se.mathworks.com/help/releases/R2019b/matlab/ref/subplot.html - I have to leave the meeting earlier, will you add the lecture to the drive? Thanks in advance! - :+1: - Is it possible to actiavte "expand axes to fill figure" option in Export setup option in File menu using code? -Thanks! - Does .svg file format play nice with latex? - Cont. I googled it myself. It really doesn't. If you are using pdflatex you will probably want to export as pdf. - Is it possible to save the figure with a transparent background in scripts? - The most recent version of export_fig includes a -transparent option for .png export. I mentioned plot2svg toolbox - It is strange. It did not work on my laptop:(( maybe it depends on the machine. Thank you. - I cannot get a high-quality figure by .svg for the following piece of code:( close all rng(0) T =20; x = randn(T,100000); delta=1.1*max(max(x)); %distance between channels for easier visualization [nChannels,nSamples]=size(x); %number of channels in the recording and duration of the signal in samples figure; plot((x+repmat([1:nChannels]'.*delta,1,nSamples))'); saveas(gcf,'Out.svg') -are there any other lectures on scientific computation planned in this academic year? https://scicomp.aalto.fi/training/scip/summer-kickstart/ https://scicomp.aalto.fi/help/garage/ Which software do you suggest for creating pictures for the experimental study as an example plot of the experiment with a human performing a task? - Inkscape or powerpoint (or google slides) -Do you make announcements of new courses via triton users mailing? Or it is better to check Aalto scientific computing webpage? - Triton list is fine, but keep an eye on the pages if you are curious. -- Please always write 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