Linux — консольная версия (только счётные ядра)

Что входит

  • tmc_rth — счётное ядро, H-поляризация (PlanarRT H);
  • tmc_rtx — счётное ядро, X-мода, в том числе подмагниченная плазма (PlanarRT X);
  • руководство пользователя в PDF рядом с ядрами, на русском и английском.

Версия работает без графики — на сервере, узле кластера или в контейнере, где есть только терминал. Текущая версия — 2.0.0, исходники и выпуски — на GitHub.

Установка

Пошаговая установка — на странице «Установка».

Особенности интерфейса

Окон нет: задание передаётся в командной строке, ход расчёта и итог выводятся в терминал.

tmc_rth [ключи] <задание.tpl>
tmc_rtx [ключи] <задание.tpl>

Пример расчёта с отчётом о времени:

tmc_rth -Time work/horn.tpl

Выходные файлы (имена — из раздела #OUTPUT задания) пишутся рядом с заданием. Ключи можно ставить до и после задания, регистр не важен.

Ключ Что делает
-Time записать рядом с заданием отчёт <задание>.timing_H_linux64.txt (…_X_… для tmc_rtx)
-GPU, -GPU:n считать на видеокарте n (с 0); см. раздел «Видеокарта»
-CPU считать на процессоре; сильнее -GPU и TMC_GPU
-DN после расчёта записать диаграммы направленности, если они заданы
-Ar, -Arb, -d принимаются для совместимости сценариев: ядра всегда считают как пакетный запуск /Arb
-q, --quiet не выводить ход расчёта
--verbose выводить ход расчёта целиком, каждую строку
--about, -v, --version о программе
--manual открыть руководство: PDF в графическом сеансе, текст в терминале (пакет poppler-utils)
--lang=ru\|en\|system язык сообщений; запоминается
-h, --help справка

Сообщения пакетного режима идут в стандартный вывод, ход расчёта — в поток ошибок: в терминале это одна обновляемая строка, в файле журнала — сообщения и раз в 10 с ход расчёта.

Код завершения Значение
0 все шаги посчитаны
1 ошибка задания: файл не найден, ошибка препроцессора, ошибка данных, нет #STEP
2 ошибка во время расчёта
3 расчёт остановлен: Ctrl+C или kill

Ошибка на шаге свипа не обрывает расчёт: S-матрица этого шага в .s записывается нулями, считается следующий шаг, в конце выводится перечень первых 10 таких шагов и код 2.

Переменные окружения:

Переменная Значение
TMC_GPU=n считать на видеокарте n-1 (то же, что -GPU:n-1)
TMC_GPU_MIN_NODES=k порог размера сетки для видеокарты; 0 — на карту идут и малые задания
TMC_AUTO_DN=1 то же, что -DN
TMC_EPS_THREADS=n число потоков заполнения ε; по умолчанию — все процессоры, кроме запаса системе
TMC_EPS_SMALL=k блок меньше k узлов заполняется в один поток
TMC_EPS_FAST=0 заполнять ε прежним медленным способом
NO_COLOR «О программе» без цвета

Видеокарта

Расчёт по времени может идти на видеокарте через OpenCL 1.2 с двойной точностью:

tmc_rth -GPU work/horn.tpl       # первая подходящая карта
tmc_rth -GPU:1 work/horn.tpl     # вторая карта

Нужны драйвер видеокарты с поддержкой OpenCL и двойной точности (cl_khr_fp64) и пакет ocl-icd-libopencl1. Проверить, что система видит карту, можно программой clinfo. Карты номеруются только среди тех, что умеют двойную точность.

Если карты или драйвера нет, расчёт идёт на процессоре, а причину называет отчёт -Time (строка Compute). Малые задания остаются на процессоре: карта ждёт порты на каждом такте и проигрывает ему; порог меняется переменной TMC_GPU_MIN_NODES. Результаты на карте и на процессоре совпадают.

Файлы

Форматы те же, что у версии для Windows (справочник). Задание с Windows можно считать без правок: окончания строк CRLF и LF читаются одинаково, относительные пути в задании могут быть записаны и с \, и с /, имя вложенного файла ищется без учёта регистра.

Если файл .s уже есть, новый расчёт сливается с ним: чтобы начать с чистого файла, удалите его перед запуском. Держите задания и результаты на родном диске Linux: ядро переписывает файлы на каждом такте.

Сборка из исходников

Нужны Ubuntu 24.04 LTS или совместимая система, g++ 13, CMake 3.22 и новее, Ninja.

sudo apt update && sudo apt install -y build-essential g++ cmake ninja-build
git clone https://github.com/klimov-kn/TMC_Suite_Linux_Console.git
cd TMC_Suite_Linux_Console
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build -j

Ядра появятся в dist/linux-x86-64/bin, библиотеки — в dist/linux-x86-64/lib. Сборка идёт без ошибок и предупреждений компилятора. Собирайте на родном диске Linux (ext4): в WSL каталог /mnt/… намного медленнее на записи.

Во время работы, кроме glibc 2.39 и новее, ничего не нужно. Необязательно: ocl-icd-libopencl1 и драйвер OpenCL — для видеокарты, poppler-utils — чтобы читать руководство в терминале.

Устройство кода — в разделах «Счётное ядро H», «Счётное ядро X», «Слой совместимости».

Отличия от версии для Windows

Расчётная часть та же, что в версии для Windows: счётные ядра собраны из того же исходного кода, форматы файлов заданий и результатов совпадают, поэтому задание, посчитанное на одной системе, открывается на другой. Метод расчёта описан в разделе «Теория метода», устройство кода — в разделе «Устройство кода».

Возможность Windows Консоль
Окно, меню, диалоги есть нет
Форматы чисел в файлах меняются в диалоге значения по умолчанию
Синхронизация с FieldView во время счёта есть нет: просмотр — после расчёта
Звук окончания шага есть (кроме /Arb) нет
Выбор видеокарты окно настройки и ключи ключи и TMC_GPU
Ход расчёта строка состояния и полоса поток ошибок
Диаграммы в пакетном режиме TMC_AUTO_DN=1 -DN или TMC_AUTO_DN=1

Числа в файлах совпадают с Windows побайтно или до последних разрядов: разные библиотеки sin и cos дают отличия в последних битах double, как между сборками Windows Win32 и x64.

Известные ограничения

  • Только x86-64 и glibc 2.39 и новее: на более старых системах собирайте из исходников.
  • Просмотрщиков результатов в этой версии нет: файлы открываются в версиях с окнами.
  • Считает один узел: запуск на нескольких машинах сразу не поддерживается. Заполнение ε идёт в несколько потоков, схема по времени — в одном потоке процессора или на видеокарте.

Linux — console edition (compute kernels only)

What is included

  • tmc_rth — compute kernel, H-polarization (PlanarRT H);
  • tmc_rtx — compute kernel, X-mode, including magnetized plasma (PlanarRT X);
  • the user manual in PDF next to the kernels, in Russian and English.

This edition needs no graphics: a compute server, a cluster node or a container with nothing but a terminal. The current version is 2.0.0; sources and releases are on GitHub.

Installation

Step-by-step installation is on the Installation page.

Interface specifics

There are no windows: the task is passed on the command line, progress and the result are printed to the terminal.

tmc_rth [keys] <task.tpl>
tmc_rtx [keys] <task.tpl>

A calculation with a time report:

tmc_rth -Time work/horn.tpl

Output files (named in the #OUTPUT section of the task) are written next to the task. Keys may stand before or after the task; case does not matter.

Key What it does
-Time write the report <task>.timing_H_linux64.txt next to the task (…_X_… for tmc_rtx)
-GPU, -GPU:n calculate on video card n (from 0); see Video card
-CPU calculate on the CPU; stronger than -GPU and TMC_GPU
-DN write radiation pattern files after the calculation, if the task defines them
-Ar, -Arb, -d accepted for compatibility of scripts: the kernels always work as the batch run /Arb
-q, --quiet do not print the progress
--verbose print the whole progress, every line
--about, -v, --version about the program
--manual open the manual: PDF in a desktop session, text in a terminal (package poppler-utils)
--lang=ru\|en\|system message language; remembered
-h, --help help

Batch-mode messages go to standard output, the progress goes to standard error: one updating line in a terminal; messages and the progress every 10 s in a log file.

Exit code Meaning
0 all steps are calculated
1 error in the task: file not found, preprocessor error, data error, no #STEP
2 error during the calculation
3 the calculation was stopped: Ctrl+C or kill

An error at a sweep step does not break the calculation: the S-matrix of that step is written as zeros to the .s file, the next step is calculated, and at the end the first 10 such steps are listed with exit code 2.

Environment variables:

Variable Meaning
TMC_GPU=n calculate on video card n-1 (same as -GPU:n-1)
TMC_GPU_MIN_NODES=k grid size threshold for the card; 0 sends small tasks to the card too
TMC_AUTO_DN=1 same as -DN
TMC_EPS_THREADS=n number of ε filling threads; by default all processors except a reserve for the system
TMC_EPS_SMALL=k a block below k nodes is filled in one thread
TMC_EPS_FAST=0 fill ε in the former slow way
NO_COLOR About without colour

Video card

The time-domain calculation can run on a video card through OpenCL 1.2 in double precision:

tmc_rth -GPU work/horn.tpl       # the first suitable card
tmc_rth -GPU:1 work/horn.tpl     # the second card

You need a video card driver with OpenCL and double precision (cl_khr_fp64) and the package ocl-icd-libopencl1. The program clinfo shows whether the system sees the card. Only cards with double precision are numbered.

If there is no card or driver, the calculation runs on the CPU, and the -Time report gives the reason (line Compute). Small tasks stay on the CPU: the card waits for the ports on every time step and loses to it; the threshold is changed by TMC_GPU_MIN_NODES. Results on the card and on the CPU are the same.

Files

The formats are those of the Windows version (reference). A task from Windows runs unchanged: CRLF and LF line ends are read alike, relative paths in a task may use \ or /, the name of an included file is found regardless of case.

If the .s file already exists, the new calculation merges with it: to start clean, delete it before the run. Keep tasks and results on a native Linux disk: the kernel rewrites its files on every time step.

Building from source

You need Ubuntu 24.04 LTS or a compatible system, g++ 13, CMake 3.22 or newer, Ninja.

sudo apt update && sudo apt install -y build-essential g++ cmake ninja-build
git clone https://github.com/klimov-kn/TMC_Suite_Linux_Console.git
cd TMC_Suite_Linux_Console
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build -j

The kernels appear in dist/linux-x86-64/bin, the libraries in dist/linux-x86-64/lib. The build gives no compiler errors or warnings. Build on a native Linux disk (ext4): in WSL the /mnt/… directory is much slower on writes.

At run time only glibc 2.39 or newer is needed. Optional: ocl-icd-libopencl1 and an OpenCL driver for the video card, poppler-utils to read the manual in a terminal.

The code is described in Kernel H, Kernel X, Compatibility layer.

Differences from the Windows version

The computational part is the same as in the Windows version: the compute kernels are built from the same source code and the task and result file formats are identical, so a task calculated on one system opens on another. The method is described in Method theory, the code structure in Code internals.

Feature Windows Console
Window, menus, dialogs yes no
Number formats in files set in a dialog default values
Synchronization with FieldView during a run yes no: view after the calculation
Sound at the end of a step yes (except /Arb) no
Choosing a video card settings window and keys keys and TMC_GPU
Progress status line and bar standard error
Patterns in batch mode TMC_AUTO_DN=1 -DN or TMC_AUTO_DN=1

Numbers in files match Windows byte for byte or to the last digits: different sin and cos libraries differ in the last bits of double, as the Windows Win32 and x64 builds do.

Known limitations

  • x86-64 and glibc 2.39 or newer only: on older systems build from source.
  • There are no result viewers in this edition: the files open in the windowed editions.
  • One node only: a run across several machines is not supported. ε filling uses several threads; the time-domain scheme runs in one CPU thread or on a video card.