로컬 설정#
Qiskit을 설치하고 실행하면, 선택 구성 단계가 있어 특정한 사용 목적에 맞도록 Qiskit의 기본 설정을 변경 할 수 있다.
사용자 구성 파일#
Qiskit의 로컬 구성을 위한 기본 위치는 사용자 구성 파일이다. 이는 Qiskit 기본값을 변경할 수 있는 ini 형식 파일이다.
예시:
[default]
circuit_drawer = mpl
circuit_mpl_style = default
circuit_mpl_style_path = ~:~/.qiskit
state_drawer = hinton
transpile_optimization_level = 3
parallel = False
num_processes = 15
By default this file lives in ~/.qiskit/settings.conf
but the path used
can be overridden with the QISKIT_SETTINGS
environment variable. If
QISKIT_SETTINGS
is set its value will used as the path to the user config
file.
사용 가능한 옵션
이는 회로 드로잉
qiskit.circuit.QuantumCircuit.draw()
및qiskit.visualization.circuit_drawer()
의 기본 백엔드를 변경하는 데 사용된다. 이는latex
,mpl
,text
또는latex_source
로 설정될 수 있으며ouptut
kwarg가 명시적으로 설정되지 않은 경우 드로잉 백엔드를 사용하게 될 것이다.이는 회로 드로잉
qiskit.circuit.QuantumCircuit.draw()
및qiskit.visualization.circuit_drawer()
에 사용되는mpl
아웃풋 백엔드에 사용되는 기본 스타일 시트이다. 이는default
또는bw
로 설정할 수 있다.
circuit_mpl_style_path
: 이는 회로 드로잉,qiskit.circuit.QuantumCircuit.draw()
또는qiskit.visualization.circuit_drawer()
이 있는 경로(들)을 설정하는 데 사용할 수 있고mpl
출력 모드를 사용할 때 json 스타일 시트를 찾는 데 사용된다.
state_drawer
: 이는qiskit.quantum_info.Statevector.draw()
및qiskit.quantum_info.DensityMatrix.draw()
와 같은 상태 시각화를 그리는 방법의 기본 백엔드를 변경하는데 사용된다. 이는repr
,text
’,latex
,latex_source
,qsphere
,hinton
, 또는 블로흐bloch
으로 설정될 수 있으며output
kwarg가draw()
방식에 따라 명시적으로 설정되어 있지 않을 때 출력 방식이 사용될 것이다.
transpile_optimization_level
: 이는 0-3사이의 정수를 취하고transpile()
과execute()
을 위한 기본 최적화 레벨을 변경하는 데 사용된다.
parallel
: This option takes a boolean value (eitherTrue
orFalse
) and is used to configure whether Python multiprocessing is enabled for operations that support running in parallel (for example transpilation of multipleQuantumCircuit
objects). The default setting in the user config file can be overridden by theQISKIT_PARALLEL
environment variable.
num_processes
: This option takes an integer value (> 0) that is used to specify the maximum number of parallel processes to launch for parallel operations if parallel execution is enabled. The default setting in the user config file can be overridden by theQISKIT_NUM_PROCS
environment variable.
환경 변수#
Qiskit의 기본 동작을 변경하기 위해 설정할 수 있는 몇 가지 환경 변수도 있다.
QISKIT_PARALLEL
: if this variable is set toTRUE
it will enable the use of Python multiprocessing to parallelize certain operations (for example transpilation over multiple circuits) in Qiskit.
QISKIT_NUM_PROC
: 병렬 실행이 활성화된 경우 병렬 연산에 대해 실행할 최대 병렬 프로세스 수를 지정한다. 기대값으로 양의 정수를 사용한다.
RAYON_NUM_THREADS
: Specifies the number of threads to run multithreaded operations in Qiskit. By default this multithreaded code will launch a thread for each logical CPU, if you’d like to adjust the number of threads Qiskit will use you can set this to an integer value. For example, settingRAYON_NUM_THREADS=4
will only launch 4 threads for multithreaded functions.
QISKIT_FORCE_THREADS
: 다중 스레드 코드가 항상 다중 스레드에서 실행되어야 함을 지정한다. 기본적으로 병렬 프로세스에서 이미 실행 중인 Qiskit 섹션에서 다중 스레드 코드를 실행하는 경우 Qiskit은 다중 스레드를 시작하지 않고 대신 해당 기능을 직렬로 실행한다. 이는 제한된 CPU 리소스에 잠재적으로 과부하가 걸리는 것을 방지하기 위함이다. 하지만 다중 프로세스 컨텍스트에서도 다중 스레드를 강제로 사용하려면QISKIT_FORCE_THREADS=TRUE
로 설정한다.