MATLAB Parallel Computing Summary
MATLAB #ParallelComputingSimple IntroductionIn MATLAB we just need to use ‘parfor’ to realize parallel computing. Here is a simple example
1234567poolnum=10; % numbers of kernelskernum=parpool(poolnum)parfor l=1:numloop%do something hereenddelete(kernum)%the delete step is very important because in cluster we may use more than a dozen cores.If we stop the program directly without closing the parallel pool, the cluster may crash or take a long time to become normal.
Python Parallel Computing Summary
Python #ParallelComputingPython Parallel Computing SummaryPython may be faster compared with MATLAB in some cases when a part of the program directly calls the C language. If we want to use Python to do parallel computation, we need use the ‘multiprocessing’ package.Very detailed introduction and examples can be found in this
https://docs.python.org/3.4/library/multiprocessing.html?highlight=process
How to use?There are many different ways of achieving multiprocessing (not multi threads which ...
MATLAB File Operation Summary
MATLAB #DataprocessingIn doing research,We often need output the result to the file and read from the file.In this note, I will summarize the methods of reading and output method in MATLAB.
Deirectly read and writemat fileWe first consider the method of saving and read the MATLAB type file. The Matrix in MATLAB can be directly saved in a “xx.mat” file. This method can save many different result in an whole single file. I really recommend this method. This can be done as follows:
12filename=['swe ...
Data Visualization Via MATALB (1d line plots)
create time: 2019 03 20
MATLAB #PlotData Visualization Via MATALB 1 dimensional dataMATLAB is a power software in scientific calculations and its plot ability is also useful. I want to summarize the most frequently used MATLAB code accoring to my usage.
plot multi lines in the same figuresThe first code is how we plot multilines in the same plot. I want to add some extra settings in this code for the default settings are not so beautiful. The following is the plot of different functions:
1234567 ...
windows好用软件收集
Collection #Software用了windows这么久了,试过各种不同的软件,现在讲一些必备的好用软件写下来。
PDF阅读器
SumatraPDF
非常轻量小巧,打开软件非常的快速。主要目标就是用来阅读pdf文档,还支持阅读djvu格式的文件。安装了ghostscript之后可以直接打开eps文件。平时用来快速查看pdf还是很好用的。缺点就是不能做标注,想做标注的画,也有很多其他的阅读器,比如adobe,福昕等等。
XODOwindows商店自带的pdf阅读器,标注功能齐全,体积小巧。
解压缩工具
Win-RAR
这一款软件实我最开始接触电脑时一直用的软件,它的名字会给人一个错觉,觉得这就是windows官方的软件,其实不是,不过用起来确实还不错。
Bandzip没有广告,性能给力。
屏幕录制工具
ScreentoGif
可以编辑录制一些小的动图,还可以制作一些动态图。很方便的教程录制、表情包制作工具。
编辑器
SublimeText3
配色好看,插件丰富,上手容易。本人尝试过用来写python, MATLAB, markdown, latex都是非常顺手的 ...
gnuplot绘制gif动图
Gnuplot #Plot初衷
本科时候学习计算物理,搞生物物理计算的老师推荐我们用fortran写计算的程序,速度非常快,而画图推荐用gnuplot, 当时课上都在用都在学,我也就入了gnuplot的坑。后来自己没有真正完全做计算,所以使用MATLAB, python写代码的时间多一些,gnuplot也就没有继续使用了。 本篇笔记是当时本科写的一个笔记,最开始发表在新浪博客。 当时也是摸索了很久,所以记录一下绘图过程。
大家都知道,gnuplot作图功能强大,但是有很多功能都是靠自己去摸索实验的,只有有创意,有想法,才会画出赏心悦目的图像。这个软件非常下,不过你所能想到的图形他都可以画。
首先提供一个gnuplot动图教程的网址 http://www.gnuplotting.org/tag/animation/
我是看了这些例子后自己摸索出来的。
画动图我分为两种,
一是直接输出很多张图片,然后用某些flash软件合成,我用的是Ulead gif animator。
另外一种是直接用代码输出绘制动图并且输出gif图片,这是本次笔记的重点。
画很多图片,然后用软件合成我直接给 ...
MATLAB parfor 进度的提取
MATLAB #ParallelComputingMATLAB parfor 进度显示用MATLAB的时候,经常会用到并行计算,用于加快速度。我们有时候还需要知道程序具体运行到哪一步,比如循环一个有100个,已经运行了多少个。如果不是parfor,我们可以采用每进行一次运算,就输出一些信息到文件的方法,比如
123456N=10;fid=fopen('progress.txt','at');for l=1:fprintf(fid,[datestr(now),' the loop step is %d \n'],l);endfclose(fid);
这样的话,就会在程序里面输出每一个循环已经执行的信息。可以看见输出的txt文件夹具有如下的内容:
1234567891002-Mar-2019 23:50:17 the loop step is 1 02-Mar-2019 23:50:17 the loop step is 2 02-Mar-2019 23:50:17 the loop step is 3 02-Mar-2019 23:50:17 the loop step is 4 ...
Linux设置定时运行脚本以及软件开机自动启动
Ubuntu有关ubuntu平台上定时运行某一软件,以及开机启动软件的方法Zhaohua Tian2018 05 31
开机启动的设置方法在windows开机启动设置比较简单,只需要在任务管理器设置就可以,在ubuntu里面也可以实现类似的功能,只需要安装一个软件:Tweak Tool.不过此方法可以设置的软件有限,只能是系统的一些特殊软件,我们要实现的是开机启动一部分脚本命令。我此次主要目的是为了开机启动Lumerical的Licence Manager,因为只有这个开启之后才能打开FDTD软件。手动开启的代码为:
1sudo /etc/init.d/lumlmadmin start
通过网上查找相关资料,得知开机启动的设置一共有两种方法:
修改/etc/rc.local文件该文件中只需要手动加入你需要开机运行的代码就可以了,该文件的格式如下:
1234567891011121314#!/bin/sh -e## rc.local## This script is executed at the end of each multiuser runlevel.# Make sure th ...
用Hexo搭建个人博客
BlogMotivation(闲扯,无关技术)从2016年接触github之后,就有做一个自己的博客的想法。目前市面上的博客平台也还是有很多的,比如新浪博客、豆瓣、知乎专栏、CSDN、博客园、简书….这些网站各有优劣,而且侧重点不同。有的偏技术,比如CSDN、博客园,有的很文艺,比如豆瓣、新浪博客,有的更加具有严谨性和学术性,比如知乎。我的要求是:
要可以记录一些自己安装软件、学习软件的教程,所以要对代码高亮支持的很好。
可以写一下自己的随笔、感悟。
可以写自己对学术问题的思考,比较浅显的思路那种,也得支持公式的输入。
想来想去还是你自己搭建一个博客吧,这些功能都可以实现,网上搜索了很多搭建个人博客的例子,有用wordpress的,有用python的(sphinx),提到的最多的就是github pages. 一步步按照注册、安装,最开始的jkelly实现,老是报错和失败,就放弃了。
去年过年回去比较闲,又开始捣鼓,生命不息、捣鼓不止。。。。尝试打算用Python,被一篇文章吸引https://blog.csdn.net/BF02jgtRS00XKtCx/article/deta ...
Latex技巧-常见特殊字符
Latex介绍Latex是我写一些非常系统化的笔记以及投稿会用到的编译系统,里面的一些基本命令还是很容易记住的,但是有一些特殊字符不是那么容易记住,还有一些其它语言如德文如何使用?我想在这李全部记录下来,免得每次都去翻很长的那个pdf文档
希腊字母 (Greek Letters)
symbols
Script
symbols
script
and
A and \alpha
N,
N and \nu
and
B and \beta
and
\Xi and \xi
and
\Gamma and \gamma
and
O and o
and
\Delta and \delta
, and
\Pi ,\pi and \varpi
E, and
E,\epsilon and \varepsilon
, and
P, \rho and \varrho
定界符 (Delimiter)
symbols
Script
symbols
script
\mid
/
${$
\{
\langle
\upar ...