CUDA new features (well, kinda new)
Support of broadcast in shared memory (working on half a warp each time, one to 1-16 threads).
A memo of Compute capability updates
1.0
…(PRE 8800 GTS)
1.1 atomic functions on 32-bit words in global memory
…(PRE GT200)
1.2 Atomic functions operating in shared memory, atomic functions operating on 64-bit words in global memory
1.2 Warp vote functions
1.2 16K local memory
1.2 32 active warps per SM, 1024 active threads per SM
1.3 Double precision floating-point numbers
…(Current Frontier)
Add comment April 21, 2009
LaTeX Tips from Practice (3)
How to display source code with keyword highlighting and proper comment color
Originally posted at here
Include the package needed with the following line:
\usepackage{listings}
A template of quoting source code with syntax highlighting is as follows:
\usepackage{color}
\usepackage{listings}
\definecolor{Brown}{cmyk}{0,0.81,1,0.60}
\definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
\definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}
\begin{document}\lstset{language=VBScript,frame=ltrb,framesep=5pt,basicstyle=\normalsize,
keywordstyle=\ttfamily\color{OliveGreen},
morekeywords={one,two,three},
commentstyle=\color{Brown},
stringstyle=\ttfamily,
showstringspaces=ture}\begin{lstlisting}
…
\end{lstlisting}
Adjust accordingly to your preferred language, style and color.
Add comment April 15, 2009
Customize syntax highlighting for CUDA in Kate/KDevelop
CUDA is a minimal extension of C/C++ to support programming on newer NVIDIA GPUs. It introduces dozens of new keywords that are frequently used in CUDA programs. Adding syntax highlighting in KDevelop (Kate) only requires several simple steps:
1. Get keywords from “usertype.dat” provided by any Windows version of CUDA SDK, this is a text file. It should be found under $(NVIDIA_CUDA_SDK)\doc\syntax_highlighting.
2. Under your Linux account, cd ~/.kde/share/apps/katepart/syntax/, there should be two xml files regarding C/C++, cpp.xml and c.xml. Make a copy of both and name them properly, e.g. cpp_cuda.xml & c_cuda.xml.
3. Perform a replace operation on each keyword in “usertype.dat” so they match the keyword format in target xml files, and then copy them into the keyword lists of target files.
4. Modify xml header, which includes language description, file extensions and other information. You probably want to add “*.cu” to the file extension list. Remember to distinguish them from the original C/C++ language tag. Save the xml files after you are done.
5. Open Kate/KDevelop, under Tools->Highlighting->Sources you should see two new entries below C++ and C, respectively.
Enjoy.
3 comments June 6, 2008
Starting a subprocess from Python
subprocess is a convenient way to fork a new process on Windows/Unix/etc. It obsoletes previous methods such as commands (which does not support Windows) and os.system()/os.popen*/os.spawn*
Here is an example:
import subprocess
cmd_lst = ['exec_file', 'arg1', 'arg2', ...]
subprocess.call(cmd_lst) #return the value returned by the callee
subprocess.check_call(cmd_lst) #return if the callee exits with 0, otherwise raise an error
Add comment May 5, 2008
Surface by Microsoft
Happened to run into the link http://www.microsoft.com/surface, this is a product that’s been announced for over a year. Very impressive.
This somewhat proves, again, that computer science is neither about computer nor science, it is math and art.
Add comment April 2, 2008
Cygwin group/passwd setting
In case anything goes wrong with user accounts, carry on the following steps:
mkpasswd -l -c > /etc/passwd
mkgroup -l -c > /etc/group
mkpasswd -d -u <username> /etc/passwd (optional)
mkgroup -d | grep <username> /etc/group (optional)
1 comment February 17, 2008
How to- Tunnel Traffic through Firewall and Remote Desktop
My department has rigid access rules, which prevail in today’s internet jungle. Sadly enough, connecting to one’s working environment is not as easy as it used to be. It took more than a breath of time and understanding to configure all the access methods I need. Though all stated here are trivial, I feel keeping a memo quite necessary, especially when all the department guidelines themselves are within the firewall.
Scenario
a) IP address space protected by a filewall
b) Access server sitting just on border of the firewall, only tunneling allowed
c) Well-known department servers inside the filewall
d) Office computer, with domain/username account and domain-affiliated NFS (OS: Windows XP SP2)
e) Home computer, OS: Windows Vista (yes, I know Linux will make remote access easier, but what about drivers of all the cool new hardware I paid big money for?)
Software on client side: OpenSSH (on Cygwin) or PuTTY or SSH Secure Shell, WinSCP
Goal 1: Set up tunnels through a border server
Edit the configuration file for OpenSSH (or do similar stuff to other clients), open the file ~/.ssh/config and put the following lines in:
host name_it_yourself
hostname hostname_domainname
user username
ForwardAgent yes
LocalForward custom_port1 hostname1:port1 #list as many as u wish
LocalForward custom_port2 hostname2:port2
IdentityFile ~/.ssh/key_for_host/id_dsa #where to store private key if pubkey is used
kick-start everything else with ssh name_it_yourself and leave it running in the background. From now on, all remote access appear as reaching for some local customized port. All the ugly things (almost all) are taken care of by the tunneling mechanism.
Goal 2: Connect to well know server inside firewall
Specify a portforwarding rule in 1, and then create a new profile (i.e. adding a new paragraph in OpenSSH config file) looking like this:
host name_it_yourself
hostname localhost # since we have already tunneled it
user username
ForwardX11 yes
port custom_port1
IdentityFile ~/.ssh/id_file
Login by running ssh name_it_yourself
Goal 3: SSH to office computer
A SSH server is required on the remote end, OpenSSH on Cygwin is one of the easiest way to do this. Set OpenSSH to service mode so that sshd.exe is lauched at booting.
On the client side, add another profile for office computer similar to 2. Remember to set up a tunnel in 1. With better control of the server end, public key authentication can be used to save password typing. Use ssh-keygen under Cygwin for a pair of keys:
ssh-keygen -f ~/.ssh/key_file -t rsa #specify where to put keys and which authentication protocol to use
Keep the private key safe and sound, probably protecting it by a password.
Distribute the pub key file on office computer by concatenate it to the SSH authorized key file (change path of the pub key accordingly):
cat ~/key_file.pub >> ~/.ssh/authorized_keys
Note: If you are using PuTTY for tunneling, remember that pub key pairs generated by PuTTY is not 100% compatible with OpenSSH. Minor modification required, or simply stick to ssh-keygen and import it in PuTTY.
Goal 4: FTP-like file access
WinSCP is a good candidate, supporting SCP and SFTP. Create a new profile in WinSCP, if pubkey is used, private key file should be loaded. WinSCP uses PuTTY style private key, and OpenSSH keys are alien to it. Therefore, a private key generated in a UNIX environment should be imported using PuTTYgen.exe and saved in PuTTY style (.ppk) before using.
Goal 5: Remote desktop to office computer
Add a tunnel to the remote RDP port by adding a line to profile in 1:
LocalForward local_port office_computer_domain:RDP_port
Make sure remote desktop is allowed on remote OS and the user is granted access. Run remote desktop on local machine and access localhost:local_port.
Note On Windows XP SP2, access to 127.0.0.1: is not allowed (loopback), use 127.0.0.2 instead. On Windows XP/2003, RDP listens on port 3389, while Windows Vista listens on 3390. Therefore, one cannot map these port as the local_port.
1 comment September 25, 2007
More LaTeX Templates
%preamble
\RequirePackage[config]{subfig}
%%%%%%%%%%%%%%%%%figure-Title%%%%%%%%%%%%%%%%
\begin{figure}[hbtp]
\centering
\subfloat{\includegraphics[width=.48\textwidth]{subfig-1}}
\subfloat{\includegraphics[width=.48\textwidth]{subfig-2}}
\caption{Foobar}
\label{fig:foobar}
\end{figure}
%%%%%%%%%%%%End of figure-Title%%%%%%%%%%%%%%
(to be continued…)
1 comment September 4, 2007
Howto… when network interface is missing
Sometimes, eth0 (or other devices) cannot be found or recognized after a reboot/NIC change. This is common after hardware replacement, or copying/modifying guest OS running on virtual machine (vmware, virtual PC).
Symptom
When trying to bring up the network interfaces, the following message (or similar) occurs:
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
ifconfig displays the local loopback.
Problem
The reason for this is a change in MAC address. Linux OS recognition and configuration of an interface is assigned with the MAC address of this interface. If it changes while the OS is running (similar to hot-plug), OS will lose the information previously gathered for this device. This is more common in linux running on top of VMware and other vm, where guest OS is often suspended, then moved.
Solution
After searching on web, I found two posts related to the problem. One is to get back the lost interface, the other is to generate a new interface for virtual machine.
For ubuntu, the MAC address of each interface is stored at /etc/iftab, editing this file with the correct MAC you learn from elsewhere, and restart the network will do the trick. For VMWare, the generated MAC address is stored in *.vmx file. Click here for the original discussion.
If you want to add a new interface for VM, follow the vmx file sample given in this post.
Add comment March 16, 2007
Shot their own feet
Live Mail filtered Microsoft Survey invitation as junk. I lost a teeny-tiny chance to win in a sweepstakes. Oh well… Do we have to take training courses in “how to compose emails in a junk-unlikely style” someday in the future?
Add comment March 4, 2008