2010年4月7日 星期三

解決ssh 連線登入問題

3.3 - ssh(1) takes a long time to connect or log in

Large delays (more that 10 seconds) are typically caused a problem with name resolution:
  • Some versions of glibc (notably glibc 2.1 shipped with Red Hat 6.1) can take a long time to resolve "IPv6 or IPv4" addresses from domain names. This can be worked around with by specifying AddressFamily inet option in sshd_config.
  • There may be a DNS lookup problem, either at the client or server. You can use the nslookup command to check this on both client and server by looking up the other end's name and IP address. In addition, on the server look up the name returned by the client's IP-name lookup. You can disable most of the server-side lookups by setting UseDNS no in sshd_config.
解決的方法, 修改 /etc/ssh/sshd_conf 裡面
UseDNS no

小於 3.7.1 版之前的請改
VerifyReverseMapping no

更早之前的如 2.9.9p2 
ReverseMappingCheck no
* Replaced sshd(8)'s VerifyReverseMapping with UseDNS option.
  When UseDNS option is on, reverse hostname lookups are always
  performed.

2010年3月24日 星期三

UNSIGNED INT

unsigned 修飾字是用於正數變數, 在32位元 


int的範圍是 -2147483648~2147483647, 加上修飾字 unsigned int, 其範圍是 0~4294967295.


補充:


  • sbyte 型別代表的是帶正負號的 8 位元整數,且介於 -128  127 的值。
  • byte 型別代表的是不帶正負號的 8 位元整數,且介於 0  255 的值。
  • short 型別代表的是帶正負號的 16 位元整數,且介於 -32768  32767 的值。
  • ushort 型別代表的是不帶正負號的 16 位元整數,且介於 0  65535 的值。
  • int 型別代表的是帶正負號的 32 位元整數,且介於 -2147483648  2147483647 的值。
  • uint 型別代表的是不帶正負號的 32 位元整數,且介於 0  4294967295 的值。
  • long 型別代表的是帶正負號的 64 位元整數,且介於 –9223372036854775808  9223372036854775807 的值。
  • ulong 型別代表的是不帶正負號的 64 位元整數,且介於  18446744073709551615 的值。
  • char 型別代表的是不帶正負號的 16 位元整數,且介於 0  65535 的值。



http://en.wikipedia.org/wiki/Integer_(computer_science)
http://programming.im.ncnu.edu.tw/Chapter5.htm

2010年3月9日 星期二

如何在 opensuse 上安裝套件

因為不常用OpenSuse 常常忘掉安裝套件的指令, 所以把指令寫起來以免日後找不到~~

#搜查資料庫
zypper search gcc

#安裝gcc
zypper install gcc33 gcc33-c++

2010年1月19日 星期二

[caution] nvcc compile

       之前為了測試 cudpp 安裝gcc-3.3, 所以系統上有二套gcc (gcc-3.3 and gcc-4.3), 為了方便測試所以把gcc and g++ link 到 gcc-3.3. 然而之後再寫cuda 程式時發現程式一直有問題, 一直找不到原因, 後來猜想也許是gcc 的問題所以把link 改回gcc-4.3, 程式再執行就正常了. 我在想也許和當時安裝driver 有關

cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  190.29  Mon Aug 24 18:10:29 PDT 2009
GCC version:  gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux)

2010年1月15日 星期五

nvcc compiler-bindir

有時侯在使用CUDA with GCC 會遇見GCC 版本的問題, 例如 CUDPP v1.1 在gcc-4.3 上使用會有問題, 目前的做法就是downgrade gcc 版本, 另一種作法是同時安裝gcc-3.3 and gcc-4.3 然後用nvcc 編譯時加上--compiler-bindir, 作法如下

1. 做個gcc 的連結
ln -s /usr/bin/gcc-3.3 ~/gcc33/gcc
ln -s /usr/bin/g++-3.3 ~/gcc33/g++

2. 用nvcc 做編譯時加上--compiler-bindir
nvcc -DUNIX -O3 -c --use_fast_math -arch sm_13 --compiler-bindir ~/gcc33