2016年6月15日 星期三

waveview notes

Tools: waveview

hotkey:
'd' --> show marker ON/OFF

Open parameter simulation results
open -> runObFile

2016年1月11日 星期一

Matlab multicore setup

I found a good material/manual
[www] http://mirlab.org/jang/books/matlabProgramming4guru/02-2_Optimization4codeNmem.asp?title=2-2%20%A5%AD%A6%E6%B3B%B2z

Here is the content:

2-2 平行處理

此外,我們也可以借用多核電腦的平行處理,來加速程式碼的執行。欲達到此功能,你的電腦必須具備多核心,而且你的系統也必須先安裝平行處理工具箱(Parallel Processing Toolbox,簡稱 PCT)。若兩者兼備,加速計算的方法如下:
  1. 在使用平行處理指令之前,下達「matlabpool local n」指令,其中 n 代表核心數目,例如 4(四核心電腦)或 8(八核心電腦)。
  2. 使用 parfor 指令來取代原來的 for 迴圈,其指令格式如下:
    parfor loopvar = initval:endval, statements, end
  3. 最後下達「matlabpool close」來關閉平行處理的功能。
我們就可以來嘗試一個簡單的範例:
Example 1: 02-程式碼與記憶體之最佳化/parfor01.mver distcomp % 顯示 PCT 的版本 matlabpool local 4 n = 100; rowMedian1=zeros(1000, 1); rowMedian2=zeros(1000, 1); % === 第一種方法:common for-loop tic for i = 1:1000 rowMedian1(i) = max(eig(rand(n))); end time1 = toc; % === 第二種方法:parallep for-loop tic parfor i = 1:1000 rowMedian2(i) = max(eig(rand(n))); end time2 = toc; fprintf('time1 = %g, time2 = %g, speedup factor = %g\n', time1, time2, time1/time2); matlabpool close------------------------------------------------------------------------------------------------------- MATLAB Version: 8.1.0.604 (R2013a) MATLAB License Number: DEMO Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1) Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode ------------------------------------------------------------------------------------------------------- Parallel Computing Toolbox Version 6.2 (R2013a) Starting matlabpool using the 'local' profile ... connected to 4 workers. time1 = 4.94823, time2 = 1.62187, speedup factor = 3.05094 Sending a stop signal to all the workers ... stopped.

在這個範例中,我們產生了 1000 個 100x100 的亂數矩陣,然後計算每一個矩陣的特徵值(共有 100個)的最大值,若使用平行處理專用的 parfor 迴圈,計算速度是一般 for 迴圈的 3 倍左右。(我的電腦是四核心。) 如果你在執行 MATLAB 時,一邊還要還要修改論文,此時若 MATLAB 佔用了所有的多核 CPU,可能會導致電腦整個慢下來,讓你無法進行文書編輯。因此 parfor 提供另一個參數,可以指定所用到的工作者個數,指令格式如下:
parfor (loopvar = initval:endval, M), statements, end
其中 M 即是所用到的核心個數。例如在下例中,雖然我的電腦是四核心,但我只使用兩核來進行 parfor 的運算:
Example 2: 02-程式碼與記憶體之最佳化/parfor02.mfprintf('MATLAB version = %s\n', version); matlabpool local 4 n = 100; rowMedian1=zeros(1000, 1); rowMedian2=zeros(1000, 1); % === 第一種方法:common for-loop tic for i = 1:1000 rowMedian1(i) = max(eig(rand(n))); end time1 = toc; % === 第二種方法:parallel for-loop using 2 workers tic parfor (i = 1:1000, 2) % 只用兩個核心 rowMedian2(i) = max(eig(rand(n))); end time2 = toc; fprintf('time1 = %g, time2 = %g, speedup factor = %g\n', time1, time2, time1/time2); matlabpool closeMATLAB version = 8.1.0.604 (R2013a) Starting matlabpool using the 'local' profile ... connected to 4 workers. time1 = 4.91713, time2 = 2.58577, speedup factor = 1.90162 Sending a stop signal to all the workers ... stopped.

由於只用到兩核,所以加速倍數接近兩倍。 在使用 parfor 迴圈時,有幾點要特別注意:
  • 因為每個迴圈可能有不同的核心同時計算,因此迴圈之間不能有相依性,否則會造成錯誤的結果,這是特別需要注意之處。
  • 在 parfor 迴圈的迴圈變數必須是整數,而且每次變大幅度都是1,以下是幾個不符合規定的範例:
    不合格的 parfor 用法說明
    parfor i = 1:2:251, 3, 5,... 非連續整數。
    parfor i = -7.5:7.5-7.5, -6.5,... 非整數。
    A = [3 7 -2 6 4 -4 9 3 7];
    parfor i = find(A>0)
    結果是 1, 2, 4,...,非連續整數。
    parfor i = [5;6;7;8][5;6;7;8]是一個行向量,而非 parfor 所須要的列向量。
PCT 是一個功能強大的工具箱,目前也可以支援多台電腦的平行運算,並可以使用 GPU(Graphic Processing Unit,圖形處理器)來進行大量的平行運算,詳細功能請參考下一小節的介紹。

MATLAB程式設計:進階篇

performing FFT by WaveView



Main steps:
1. open the waveform file and click on ADC output signals
2. performing ADC function
3. performing DAC function
4. performing FFT function

Steps:
1. execute the waveview binary file
>> wv &


2. open the waveform file, arrange signals from MSB to LSB (top-to-down)
eg. ~/ADC/spectre/schematic/psf/tran.tran

 3. select all signals and then click on the ADC icon
 4. 


5. group the A2D signals as one signal





6. performing DAC function on the grouped signal


 7. select the reconstructed waveform and press the tools/FFT icon


































2015年11月13日 星期五

Centos 7 as my Desktop

x86_64 version
Softwares:

[chrome]
Recommended plugins:
line: for chattering

[dropbox]
download and install without any problems

[firefox]
Recommended plugins:
bbsfox: for telnet connection
adblocker: blocks some disturbing ads
downhelper: download youtube videos
torrent tornado: downlad files by torrent/magnetic links

[mplayer]
step 1: fedora sources
>> rpm -Uh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

step 2. ElRepo sources (http://elrepo.org/tiki/tiki-index.php)
Key:
>>rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
add sources
>>rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (for RHEL-7, SL-7 or CentOS-7)

step 3:
.My RPM repositories for EL (RHEL, CentOS, ScientificLinux etc) (http://li.nux.ro/repos.html)
    EL7: yum -y install epel-release && rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
  [[ EL6: yum -y install epel-release && rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm  ]]
  

step 4: check epel,elrepo, nux-dextop
>> yum repolist

step 5: install required libraries
>> yum -y --enablerepo=nux-dextop install gstreamer-ffmpeg  vlc   gstreamer-plugins-ugly gstreamer-ffmpeg gstreamer-plugins-bad gstreamer-plugins-ugly ffmpeg libvdpau mpg123   mplayer mplayer-gui  gstreamer-plugins-bad-nonfree gstreamer1-libav gstreamer1-plugins-bad-freeworld gstreamer1-plugins-ugly

step 6: install
>> yum install mplayer

optional:
>> yum install vlc

step 7: done

step 8: bug and solutions
no sound for mp4 files when using mplaer

[Ref] http://junight.blog.51cto.com/10828785/1707807
[Ref] http://blog.csdn.net/sidely/article/details/44671257

[Skype]
http://tecadmin.net/install-skype-centos-rhel-fedora/

[XnViewMP]
>> yum install qt5-qtbase qt5-qtbase-common qt5-qtbase-gui qt5-qtscript xcb-util-renderutil xcb-util-wm qt5-qtmultimedia qt5-qtsensors qt5-qtsvg qt5-qtwebkit qt5-qtx11extras
>> wget http://download.xnview.com/XnViewMP-linux.x86_64.rpm
conflicts with filesystem:
>> yum install  rpmrebuild
>> rpmrebuild -ep XnViewMP-linux.x86_64.rpm
Your configured editor (probably vi) will pop up with an already loaded file.

Search for the lines containing / and /usr/bin (lines like %dir %attr(0755, root, root) "/"), and remove them. They are starting in about line 340.
(I removed the line with /usr as well.)

Save end exit.
Answer yes. It will then tell you the location of the fixed rpm.
 

>> rpm -ivh  XnViewMP-linux.x86_64.rpm
>> xnview &
done


[cadence/icfb&]
yum install glibc.i686
yum install libXt.{i686,x86_64}
yum install mesa-libGLw
yum install libXp libXp-devel
yum install xorg-x11-fonts-ISO8859-1-100dpi
yum install xorg-x11-fonts-ISO8859-1-75dpi
yum install liberation-mono-fonts liberation-fonts-common liberation-sans-fonts liberation-serif-fonts
yum install libXext.i686
yum install libXp
yum install xorg-x11-libs.i386
yum install glibc.i686 libX11.i686 libXext.i686 libstdc++.i686 pulseaudio-libs.i686
yum install libXext  libXrender  fontconfig  libfontconfig.so.1
yum install libXp.so.6
 
or 
 
yum install glibc.i686 libXt.{i686,x86_64} mesa-libGLw libXp libXp-devel xorg-x11-fonts-ISO8859-1-100dpi xorg-x11-fonts-ISO8859-1-75dpi liberation-mono-fonts liberation-fonts-common liberation-sans-fonts liberation-serif-fonts libXext.i686 libXp xorg-x11-libs.i386 glibc.i686 libX11.i686 libXext.i686 libstdc++.i686 pulseaudio-libs.i686 libXext  libXrender  fontconfig  libfontconfig.so.1 libXp.so.6 
 
reboot to load some fonts 
[ref] https://www.ptt.cc/bbs/Electronics/M.1437491329.A.8D4.html


[madedit-mod]

[Ultraedit]
>> mkdir ~/local
>> cd ~/local
>> rpm2cpio ultraedit.rpm | cpio -idmv
>> rm -rfd ~/.idm/uex
>> rm -rf ~/.idm/*.spl
>> rm -rf /tmp/*.spl
>> alias ue='rm -rfd ~/.idm/uex; rm -rf ~/.idm/*.spl; rm -rf /tmp/*.spl;  /usr/local/bin/uex &'



[vm tools share folder]
[ref] https://simukti.net/blog/2016/09/10/centos-7-vmware-tools-mount-shared-folder/
>> yum install open-vm-tools
>> yum -y install open-vm-tools open-vm-tools-devel
>> yum -y groupinstall "Development Tools"
insert vmtools cdrom to /run/media/VMtools/ & press enter all the way

>> ./vmware-install.pl
check for kernel module

>> lsmod | grep hgfs
Check service
>> systemctl status vmware-tools
Check shared folder
>> df -h
e.g. .host:/ 465G 221G 244G 48% /mnt/hgfs
enable on boot
>> systemctl enable vmware-tools


[python3.4]
>> yum install epel-release
>> yum search python3
>> yum install python34
>> yum install python34-setuptools
>> easy_install-3.4 pip
>> easy_install-3.4 requests
>> pip3 -V

[exFAT support]
>> yum -y install epel-release
>> yum localinstall -y --nogpgcheck http://download1.rpmfusion.org/free/el/updates/7/x86_64/f/fuse-exfat-1.2.7-1.el7.x86_64.rpm
>> yum install http://download1.rpmfusion.org/free/el/updates/7/x86_64/e/exfat-utils-1.2.7-1.el7.x86_64.rpm 

[suspend]
hold 'Alt' before press power button 

[NTFS support]
yum install epel-release
yum -y install ntfs-3g
yum install fuse
modprobe fuse

[bootloader scan]
yum install -y ntfs-3g 
grub2-mkconfig -o /boot/grub2/grub.cfg 



cat /boot/grub2/grub.cfg |grep menuentry
grub2-set-default "CentOS Linux (4.9.9-1.el7.elrepo.x86_64) 7 (Core)"
or  grub2-set-default 3
grub2-editenv list

[remove old kernels]
yum install yum-utils 
package-cleanup --oldkernels --count=2
 









2015年10月4日 星期日

Cadence IC5141 coexists with IC616



Results:

Key variable:
setenv CDS_VERSION IC616
setenv CDS_Netlisting_Mode Analog
setenv CDS_CONTROLLED_AMS_ULTRA_RELEASE_ENABLED
setenv CDS_ROOT ${cadpath}/cadence/IC/616
setenv CDSHOME ${CDS_ROOT}
setenv PSF_WRITE_CHUNKS_MODE_ON true
unsetenv OA_HOME
set path = (${CDSHOME}/tools/bin ${CDSHOME}/tools/dfII/bin ${path})

Ref:
1. http://bbs.eetop.cn/thread-318533-1-1.html

2014年7月31日 星期四

Centos 6 Samba Win 7 XP can't copy/write



Recently, I updated my server to CentOS 6.5 X64 version

I configured the machine usual
> yum install samba
I found out the samba service is ok from centos(server) to centos(client), but CentOS(server) <-> Win7(client) failed.

I can login and see files, but I can't copy files to the folder or edit it.

The root cause is that the protocol is changed by microsoft.

If you have the same question, do the following steps. It works for me.
Nothing is guaranteed.

> yum remove 'samba*'
yum install samba4* krb5* -y      

and according to the following setup

cp /etc/samba/smb.conf /etc/samba/smb.conf.bak    //備份一下samba的配置文件,        
vim /etc/samba/smb.conf          
下面綠色字體为原有的,粟色字體的为增加的,藍色字體为修改的        
#======================= Global Settings =====================================        
[global]
dos charset = GB2312            
unix charset = GB2312            
display charset = GB2312
# ----------------------- Network Related Options -------------------------        
workgroup = MYGROUP --改为-->  WORKGROUP         //指定機器在網络上所屬的NT域名或組名(可改可不改)        
server string = Samba Server Version %v                //此選項是可選的,主要作用是Samba服務Windows系統注釋        
netbios name = MYSAMBA        //這個改不改隨意,它就象windows裏的機器名        
interfaces = lo eth0192.168.88.35/24        //這裏寫本機IP地址,如果有多個網络也可以寫多個IP        
hosts allow = 127.192.168.88.            //設定允許訪問samba的IP地址或IP地址範圍        
wins support = yes    //設定samba提供WINS服務,通常無特殊原因設为no,除非所處網络上沒有主機提供WINS服務且需要samba提供WINS服務是才設yes        
dns proxy = yes  --改为--> no          
name resolve order = wins host lmhosts bcas            
bind interfaces only = yes
# --------------------------- Logging Options -----------------------------        
log file = /var/log/samba/log.%m        // log會在此目錄中为每個登陆用戶(Samba用戶)建立不同的日志文件        
log level = 2          
max log size = 500
# ----------------------- Standalone Server Options ------------------------        
security = user        //設定安全級別为user        
passdb backend = tdbsam --改为-->   smbpasswd:/etc/samba/smbpasswd
# --------------------------- Printing Options -----------------------------        
load printers = yes          
cups options = raw
#============================ Share Definitions ==============================        
#如果注釋掉了[homes]則用戶就看不到自己的家目錄        
#[homes]          
#        comment = Home Directories          
#       browseable = no          
#       writable = no          
#;       valid users = %S          
#;       valid users = MYDOMAIN\%S          
[printers]          
       comment = All Printers          
       path = /var/spool/samba          
       browseable = no          
       guest ok = no          
       writable = no          
       printable = yes
[share]            
        comment = Share        //定義共享目錄名稱,可用任意字符串        
path = /home/share       //設定共享目錄路徑        
public = no                       //指定該共享是否允許guest账戶訪問        
available = yes        //用來指定該共享資源是否可用        
admin users = itadmin    //指定該共享的管理員,對該共享具有完全控制權限,如果用戶驗證方式設置成“security=share”時,此項無效。        
valid users = +mgr,+periphery,+filemgr   //用來指定允許訪問該共享資源的用戶,單個用戶就直接寫用戶名,組就是“+組名”        
writable = yes                //是否允許寫入,這項對下面的幾項來說是首選,這項設置为NO,下面的create mask directory mask 等一系列預設值無效        
write list = +mgr,+periphery,+filemgr      //指定在該共享下有寫入權限的用戶        
create mask= 0755            //表示新建文件的預設值,文件所有者全部權限,組內用戶及其他用戶可讀可執行        
directory mask= 0755        //表示新建目錄的預設值,目錄所有者全部權限,組內用戶及其他用戶可讀可執行        
browseable = no    //指定該共享是否可以瀏覽        
[project]            
         comment = project            
         path = /home/project            
         public = no            
         available = yes            
         admin users = itadmin            
         writable = yes            
         write list = +periphery            
         valid users = +periphery            
         create mask= 0755            
         directory mask= 0755            
         browseable = no            
[projectmgr]            
         comment = projectmgr            
         path = /home/projectmgr            
         public = no            
         available = yes            
         admin users = itadmin            
         writable = yes            
         write list = +mgr            
         valid users = +mgr            
         create mask= 0755            
         directory mask= 0755            
         browseable = no            
[filemgr]            
         comment = filemgr            
         path = /home/filemgr            
         public = no            
         available = yes            
         admin users = itadmin            
         writable = yes            
         write list = +filemgr            
         valid users = +filemgr            
         create mask= 0755            
         directory mask= 0755            
         browseable = no
配置完後通過testparm來檢查        
說明一點:
samba3.x的早期版本默認使用tdb庫也就是smb.conf默認設定为passdb backend = tdbsam,只需要注釋掉該行添加smb passwd file = /etec/samba/smbpasswd即可使用smbpasswd存儲加密密鑰。從samba3.5.6開始samba規範了passdb backend参數的使用,取消了smb passwd file設定,如果簡單注釋掉passdb backend参數,密鑰文件也不會被存儲到smbpasswd。所以很多人說怎麼修改smb.conf的配置,smbpasswd文件都無法生成,就算手工創建,內容也是0字節。要用傳統的文本方式存儲只需這样設定passdb backend = smbpasswd:/etc/samba/smbpasswd(後面跟的是絕對路徑)>,不要再寫smb passwd file = /etc/samba/smbpasswd,該参數已經不适用於新版本的samba了。

启動smb及nmb服務        
service smb start        
service nmb start        
nmb 是Samba 的主要启動服務器,讓其它機器能知道此機器共享了什麼;如果不打開nmb服務器的話,只能通過IP來訪問            
注意:在Samba服務器運行其間,更改了配置最好用service smb reload命令,不要用restart,這样可以防止用戶在連接的過程中被中斷            
將smb與nmb加入启動服務
chkconfig --level 35 smb on          
chkconfig --level 35 nmb on

查看端口        
netstat -antup |grep smb          
netstat -antup |grep nmb          

第五步:設置用戶
smbpasswd -a itadmin
New SMB password:          
Retype new SMB password:          
Added user itadmin.          
注:如果想要讓/etc/samba/sabpasswd生效,要先启動samba,不然還是以默認的tdbsam方式來記錄密碼
刪除用戶:smbpasswd -x username

更改用戶密碼:smbpasswd username

[Ref] http://fanli7.net/a/caozuoxitong/OS/20130910/422195.html