코딩중에 발생하는 파일 비교에 대해서 리눅스와 윈도우에서 파일을 비교하는 방법을 간단히 정리 하겠습니다.

리눅스에서는 Diff 명령어를, 윈도우에서는 Ultracompare 를 이용해서 비교해보았습니다.



* 리눅스의 경우


이름
diff - 두 파일에서 차이점을 찾는다.

사용법
diff [options] from-file to-file

설명
간단한 예로, diff 는 from-file 와 to-file 의 두파일의
내용을 비교한다. - 의 파일명은 표준입력으로부터 읽어들여
내용을 나타낸다. 특별한 경우로, diff - - 는 자기 자신을
표준입력으로 비교한다.

If from-file 이 디렉토리이고, to-file 이 아니라면 diff 는
to-file의 파일과 from-file안의 파일을 비교한다.

from-file 과 to-file 이 모두 디렉토리라면, diff 는 알파벳
순서로 두 디렉토리 안의 상응하는 파일을 비교한다; 이
비교는 -r이나 -recursive옵션이 주어지지 않으면 재귀적이
아니다. diff 는 파일인양 실제 디렉토리를 비교하지는
않는다. 표준입력은 같은 이름을 가진 파일개념을 적용하지
않기때문에 꽉찬 파일은 표준입력되지 않을 수 있다.

ex)) [kim1201@node001 source]$ diff ./flux.f90 ~/sc/spmixing/flux.f90
9a10
>   use parallel_mod
29a31,34
> character(len=2)::suffix
>
> write(suffix,'(i2.2)')myid+1
> open(1,file='debug.'//suffix)
49,50c54,57
<   do k = 2, ke-nghost
<     do j = 2, je-nghost
---
>   do k = 2, ke-nghost
> !  do k = kst_indx,kend_indx
>     do j = 2, je-nghost
> !     do j = jst_indx,jend_indx
53c60,67
< !
---

각 라인 넘버와 차이나는 명령어에 대해서 text 로 출력됨




* 윈도우에서 울트라 에디터를 이용해서 파일 비교를 하는 경우

울트라 에디터의 경우 울트라 컴패어가 기본으로 깔리게 되고, 울트라 컴패어를 이용해서 파일 비교를 하면 됩니다.

울트라 컴패어는 울트라 에디터에서 UC 라고 적혀있는 아이콘을 누르시면 됩니다.

(빨간 원 안이 울트라 컴패어 아이콘)


그 후에 다음과 같이 비교 파일을 선택해서 비교하시면 됩니다.

참고로 모든 파일을 보면서 비교를 하거나, 틀린 부분만, 아니면 공통 부분만 확인할 수 도 있습니다.





결론은 두가지 모두 유용하게 쓸수는 있겠습니다만... 역시 윈도우 환경에서 비교를 하는게 훨씬 보기도 쉽고 비교도 바로 되는 군요...

'리눅스이야기' 카테고리의 다른 글

vi quick reference guide  (0) 2009.12.07
클러스터에서 병렬 Fluent 이용하는 방법  (0) 2009.12.07
MPICH 이용법  (0) 2009.04.01
레드햇 root pass 분실시  (0) 2009.04.01
이용자 제한...& 공지사항  (0) 2009.04.01
Posted by 스핏파이어
,



원본글(https://wiki.duke.edu/display/SCSC/MPICH+Parallel+Library)

소개:

MPI(Message Passing Interface)는 병령 실행 프로그램에서 노드에 분산된 프로세스 사이에 정보를 교환하는 메시지를 전달하는 방법을 정의한 규약 중 하나이다.

MPICH 는 MPI 표준규약이 적용된 프리, 오픈소스이다. 이 프로그램은 Argonne National Lab 과 Mississippi State University 에서 작성하였으며 MPI-1.1을 따른 MPICH 와 MPI-2 에 따른 MPICH2 가 있다.


MPICH 이외에도 다양한 MPI 패키지가 존재하며, LAM/MPI, MPI/Pro 등이 있다.


현재 MPICH 의 버전은 05.11.4일 배포된 1.2.7 버전을 마지막으로 배포를 중단하였으며, MPICH 2를 이용할 것을 권장하고 있다.


Compiling with MPICH

To compile an MPI code for MPICH, use:

mpicc -O -o runme runme.c

where -O is the usual compiler optimization switch, and runme is the program to be compiled. Since mpicc is just a wrapper to a sequential compiler (maybe gcc or Intel's icc), it accepts all the usual switches and options. It will add the necessary search paths for the MPI libraries and headers, so you don't need to worry about where they are.

If you are doing it "by hand," then you may need something like the following:

gcc -I/opt/mpich/include -o runme runme.c -L/opt/mpich/lib -lmpich

Of course, you'll need to add any other compiler optimizations or libraries that your program may need.

To use MPICH with the Intel compilers you can do one of two things:

At the compile line:

mpicc -cc=/opt/intel/bin/icc ...args...
mpif77 -fc=/opt/intel/bin/ifc ...args...

In your .cshrc file:

setenv MPICH_CC /opt/intel/bin/icc
setenv MPICH_CLINKER /opt/intel/bin/icc
setenv MPICH_F77 /opt/intel/bin/ifc
setenv MPICH_FLINKER /opt/intel/bin/ifc

To force the use of the Gnu compilers, use:

mpicc -cc=/usr/bin/gcc ...args...
mpif77 -fc=/usr/bin/g77 ...args...

Or similar changes to your .cshrc file.

Running

To run an MPI code under SGE, you'll need to make an SQE submission script first. See the SGE Queuing System web page for details on how to create such a script. You will use the following to launch your parallel job:

mpirun -np $NSLOTS -machinefile $TMPDIR/machines runme -arg1 -arg2

where -arg1 and -arg2 are arguments to your code (if needed). The -np and -machinefile arguments are for the mpirun program itself. The variable $NSLOTS is set automatically by SGE to the number of "slots" or CPUs that you were actually given (recall that you can request a range of CPUs from SGE, $NSLOTS says how many you were actually given).

A list of the actual machines you were given is in a file in $TMPDIR/machines. This is a simple text file with one hostname per line, it is used by MPICH to spawn your jobs on the proper machines (otherwise, our automated job-killer program might remove your remote processes).

MPICH Version 2

The default MPICH library, v.1.2, is in /usr/bin, /usr/lib, and /usr/include. This should be adequate for most users and is in the "normal" execution path so it should be visible without modifications to your .cshrc or bashrc file. We also have installed MPICH Version 2 in /opt/mpich2. To use it, you must explicitly add the following directory to your path (and add it before /usr/bin):

set path = ( /opt/mpich2/bin $path )

When you type 'which mpicc' you should see /opt/mpich2/bin/mpicc (if you see /usr/bin/mpicc, then you are still using MPICH v.1.2). You use 'mpicc' and 'mpif77' as with MPICH v.1.2, but to run your code, you must use 'mpiexec' instead of 'mpirun' in your job scripts:

mpiexec -rsh -nopm -n $NSLOTS -machinefile $TMPDIR/machines mpiprog

The arguments are needed by MPICH-2 in order to properly interact with SGE.

P4 Memory Errors

If you get errors from MPICH saying something like:

p4_shmalloc returned NULL

or:

p4_error: alloc_p4_msg: Message size exceeds P4s maximum message size: 344530944

then you may need to alter the amount of memory used by MPICH. The P4_GLOBMEMSIZE variable can be made larger by changing your .cshrc file and adding:

setenv P4_GLOBMEMSIZE 1073741824

or some other amount of memory that you need. Increasing this amount reduces the amount of memory left for your program to use, so do not raise P4_GLOBMEMSIZE unless you need to. Note that you may need to set it to 2x or 3x the max message size that your program sends – experiment with the value and use the minimum P4_GLOBMEMSIZE value that works for you.

Note also that some of the DSCR machines have only 1GB of memory, shared between 2 CPUs – if you set P4_GLOBMEMSIZE to 512MB or more, you should also add a memory request to SGE (see SGE Queueing System:

#$ -l mem_free=2G

where '2G' would represent your P4_GLOBMEMSIZE amount PLUS the main memory needed by your program (so it may need to be much more than 2G).

Posted by 스핏파이어
,



부팅후 e 키를 누르고

kernel 정보 뜨고 프롬프트 입력창 도출

다음과 같이 수정

kernel ********* quiet single


다시 b 눌러서 부팅후 shell 도달

shell 에서 passwd type

#passwd

그후에 수정하면 됨...
Posted by 스핏파이어
,



$vi /etc/passwd

안에서 해당 ID 주석처리하면 이용 중지됨...


처음에 공지사항 이용하기..

$vi /etc/motd

여기에 내용 넣으면 공지사항 됨...(motd=message of today)

'리눅스이야기' 카테고리의 다른 글

MPICH 이용법  (0) 2009.04.01
레드햇 root pass 분실시  (0) 2009.04.01
PBS 에서 홀수 프로세서를 이용하기  (0) 2009.04.01
리눅스 삭제 윈도우 복구  (1) 2009.04.01
mpich 이용시 아무런 이유없는 에러  (0) 2009.04.01
Posted by 스핏파이어
,



윈도우와 리눅스를 같이 사용하고 있는 경우 리눅스의 삭제 방법은 간단히 윈도우 안에 들어가서 리눅스의 파티션을 삭제하는 방법입니다.

그런데 이렇게 파티션을 삭제하고 바로 부팅을 하는 경우 윈도우용 부트로더도 날아가게 되어서 부팅이 안되는 문제가 발생합니다.

이럴때 이용하는 명령이 fixboot, fixmbr 명령어 입니다.

이미 리눅스를 삭제하신후 바로 윈도우를 재부팅하셨거나, 부트로더를 살리시지 않으신 분들은 아래의 윈도우 설치 CD 를 이용하는 방법으로 복구를 해주시면 됩니다.


XP 인 경우,

1. 복구씨디를 넣고 부팅시작.

2. 윈도우 설치화면에서 복구(R) 콘솔로 시작..
3. 복구콘솔에서 복구할 경로 번호누르고 엔터..(이거 안치면 다시 재부팅됨)

4. 그다음에 관리자 비번 치면 프롬프트 창에 커서 위치.

5. c:\fixboot

6. y 누르고 엔터

7. c:\fixmbr

8. y 누르고 엔터

9. c:\exit

10. 재부팅후 윈도우 시작됨.


Win 7 인 경우,

>set PATH=%PATH%;C:\Windows\System32
>bootrec /fixboot
>bootrec /fixmbr


가장 좋은 방법은 아마도 리눅스를 삭제하고 재부팅 하지 않은 윈도우 상태에서 복구를 하는 방법일 겁니다.


이때 이용하실 수 있는 방법은 간단히 관련 프로그램을 이용하시는 겁니다.

저는 MBR fix 프로그램을 이용하였는데요. 이용법은 간단합니다.

압축을 푸신후 c: 상에 폴더를 위치시킨후..

>Mbrfix /drive 0 fixmbr

하시면 됩니다.


저의 경우  윈도우 7 상에서 작업을 했었는데..

기본적으로 관리자 권한을 완전히 풀지 않은 경우 권한문제로 fixmbr 이 되지 않을 수 있습니다.

이때는 커맨드창을 관리자 권한으로 열어주신후에


>Mbrfix /drive 0 fixmbr /win7 /yes

하시면 뿅 하고...아무것도 안 나타납니다. 하지만 변경이 된겁니다.

이제 다시 재부팅 하시면 윈도우 7 이 다시 보이실 겁니다.









Posted by 스핏파이어
,



우선 이용할 컴퓨터에서 exceed 작동시키고..


터미널창을 이용하여 접속한뒤에 다음과 같이 입력


$export DISPLAY=***.***.***.***:0.0


여기서 ***.***.***.*** 부분은 자신이 현재이용하는 컴퓨터의 IP 되겠습니다.


그런후에...


$fluent 3ddp  또는 2d , 2ddp 이용해서 실행하면 됩니다.


그럼 터미널을 통해서 리눅스환경의 화면이 자신이 이용하는 컴퓨터로 export 되어서 보여지게 됩니다.


----------------------------------------------------


혹시 multi 로 돌리고 싶으신 경우~~


hostfile 을 이용경로에 작성하시고...hostfile 은 다음과 같이...


node001:2

node002:2

이런식으로 이용하고자 하는 노드와 cpu 개수를 적으시고 파일명은 자신이 원하는 것으로 이용.. 예제에서는 hostfile 이라 칭하겠음


$fluent 2ddp -t4 -pnmpi -cnf=./hostfile&

위와 같이 쓰고 이용하면 됩니다.

-t4 는 cpu 4개 이용이구요.. 만약 8개 이용하시면 -t8 이겠죠..


그뒤는 그냥 두시고 (mpi) 이용하겠다는 것이니깐..


-cnf 부분은 호스트 파일 경로를 지정해 주면 됩니다...


** emergence kill 경우 혹은 작업내용이 남았을 경우

$sh kill-fluent-node***  이용 해서 스크립트 내용 작업 실행


Posted by 스핏파이어
,