# NAMD 2.12 (GPU 버전) 설치

NAMD(Nanoscale Molecular Dynamics)는 분자 동역학 시뮬레이션을 위한 컴퓨터 소프트웨어 입니다. 병렬 효율성이 뛰어나고 대규모 시스템을 시뮬레이션하는데 자주 사용됩니다.

이 문서에서는 NAMD 2.12 소스를 (CUDA 기반의) GPU 기능을 사용하는 버전으로 설치하는 방법에 대하여 소개합니다.

## **가. 설치 환경**

| 구분            | 내용                                |
| ------------- | --------------------------------- |
| 대상 시스템        | 뉴론                                |
| OS Version    | 리눅스 / CentOS 7.9                  |
| CPU           | Intel Xeon E5-2670 v2             |
| 컴파일러          | Intel 2018 Version                |
| MPI           | Mvapich2 2.3 Version              |
| <p>기타<br></p> | Intel MKL Math Library, CUDA 10.0 |

## **나. 설치 전 환경 설정**

KISTI 시스템은 PATH, LD\_LIBRARY\_PATH 등을 쉽게 하기 위하여 OpenSource 인 Environment Modules(<http://modules.sourceforge.net)이> 구성되어 있으며, 이하 설치 소개 에서는 module load를 이용한 환경 설정 방법을 이용합니다.

***

**\[ 환경 설정 ]**

```shell-session
$ module load intel/18.0.2 cuda/10.0 cudampi/mvapich2-2.3
```

## **다. 설치 과정**

설치 과정 소개는 tar를 이용한 압축 해제 방법과 설정 방법 등 진행 절차를 위주로 설명하고, 소스 파일 다운로드 등은 생략합니다.

### **1. charm-6.7.1 설치**

NAMD 소스는 charm을 이용하여 빌드한다. charm은 NAMD 소스내에 tar파일 형태로 포함되어 있으며 NAMD 소스를 압축 해제 후 NAMD 소스 파일안에서 설치를 진행합니다.

\[설치과정]

```shell-session
$ tar xvf NAMD_2.12_Source.tar.gz
$ cd NAMD_2.12_Source


$ tar xvf charm-6.7.1.tar
$ cd charm-6.7.1
$ ./build charm++ verbs-linux-x86_64 icc smp --with-production -static-intel
```

NAMD의 설치 과정에서 호출되는 cuda 식별자 이름이 CUDA 9.1 이후 버전부터 삭제되어 주석처리를 통하여 해당 식별자를 비활성화&#x20;

※ "**cufftCheck(cufftSetCompatibilityMode**" 이 포함된 10개 line 주석처리

\[설치과정]

```shell-session
$ cd ..
$ vi src/CudaPmeSolverUtil.C

<수정 전>
cufftCheck(cufftSetCompatibilityMode(forwardPlan, CUFFT_COMPATIBILITY_FFTW_PADDING));
cufftCheck(cufftSetCompatibilityMode(backwardPlan, CUFFT_COMPATIBILITY_FFTW_PADDING));
<수정 후>
//cufftCheck(cufftSetCompatibilityMode(forwardPlan, CUFFT_COMPATIBILITY_FFTW_PADDING));
//cufftCheck(cufftSetCompatibilityMode(backwardPlan, CUFFT_COMPATIBILITY_FFTW_PADDING));
```

### **2. NAMD-2.12 설치** GPU를 사용하기 위해서는 아래와 같이 config 수행시에 --with-cuda, --cuda-prefix 옵션을 추가로 기재

\[설치과정]

```shell-session
$ cd ..
$ ./config Linux-x86_64-icc --charm-base ./charm-6.7.1 \
--charm-arch verbs-linux-x86_64-smp-icc \
--with-tcl --with-mkl --mkl-prefix /apps/compiler/intel/18.0.2/mkl \
--with-cuda --cuda-prefix /apps/cuda/10.0


$ cd Linux-x86_64-icc
$ make
```

## **라. 뉴론 시스템에 설치된 NAMD-2.12 사용**

위의 설치 과정에서 소개된 옵션들을 사용하여 설치된 NAMD의 사용방법\
실행 예제 파일은 apoa1 시뮬레이션 예제 데이터 파일을 다운받아 사용

\[실행방법 예시]

```shortcode
$ module load intel/18.0.2 cuda/10.0 cudampi/mvapich2-2.3 module load namd/2.12
$ namd2 apoa1.namd
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-ksc.gitbook.io/blog/install/neuron/namd-2.12-install-gpu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
