
У меня есть код LaTeX, который выдает следующие ошибки в определенной строке:
Incomplete \iffalse; all text was ignored after line 140.
Forbidden control sequence found while scanning text of \write.
на строке 140
и затем в конце документа:
Argument of \@gobble has an extra }. \end{document}
Missing } inserted. \end{document}
- и т. д.
Следующий код выдал ошибку (строка 140 находится y[ row[i] ] += ...
в \section{COO Kernel}
):
\documentclass[11pt,oneside,czech,american]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=4cm,bmargin=3cm,lmargin=3cm,rmargin=2cm,headheight=0.8cm,headsep=1cm,footskip=0.5cm}
\pagestyle{headings}
\setcounter{secnumdepth}{3}
\usepackage{url}
\usepackage{listings}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{xcolor}
\makeatletter
\newenvironment{lyxlist}[1]
{\begin{list}{}
{\settowidth{\labelwidth}{#1}
\setlength{\leftmargin}{\labelwidth}
\addtolength{\leftmargin}{\labelsep}
\renewcommand{\makelabel}[1]{##1\hfil}}}
{\end{list}}
\usepackage[varg]{txfonts}
\usepackage{indentfirst}
\clubpenalty=9500
\widowpenalty=9500
\hyphenation{CDFA HARDI HiPPIES IKEM InterTrack MEGIDDO MIMD MPFA DICOM ASCLEPIOS MedInria}
\definecolor{light-gray}{gray}{0.95}
\newcommand{\code}[1]{\colorbox{light-gray}{\texttt{#1}}}
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\definecolor{Darkgreen}{rgb}{0.0, 0.2, 0.13}
\lstset{
backgroundcolor=\color{lbcolor},
tabsize=4,
language=[GNU]C++,
basicstyle=\scriptsize,
upquote=true,
aboveskip={0.001\baselineskip},
columns=fixed,
showstringspaces=false,
extendedchars=false,
breaklines=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
frame=single,
numbers=left,
showtabs=false,
showspaces=false,
showstringspaces=false,
identifierstyle=\ttfamily,
keywordstyle=\color[rgb]{0,0,1},
commentstyle=\color[rgb]{0.026,0.112,0.095},
stringstyle=\color[rgb]{0.627,0.126,0.941},
numberstyle=\color[rgb]{0.205, 0.142, 0.73},
}
\lstset{
backgroundcolor=\color{lbcolor},
tabsize=4,
language=C++,
captionpos=b,
tabsize=3,
frame=lines,
numbers=left,
numberstyle=\tiny,
numbersep=5pt,
breaklines=true,
showstringspaces=false,
basicstyle=\footnotesize,
keywordstyle=\color[rgb]{0,0,1},
commentstyle=\color{Darkgreen},
stringstyle=\color{red},
}
\lstset{
morekeywords={__global__},
alsoletter={.},
morekeywords={blockDim.x},
morekeywords={blockIdx.x},
morekeywords={threadIdx.x}
}
\usepackage{babel}
\begin{document}
\tableofcontents{}
\chapter*{Implementation/Kernels of formats}
\addcontentsline{toc}{chapter}{Implementation/Kernels of formats}
\setcounter{chapter}{3}
\setcounter{section}{0}
\section{DIAG Kernel}
\begin{lstlisting}[caption= SpMV pseudocode using DIAG format for storing a matrix from \textit{Efficient sparse matrix-vector multiplication on CUDA} \cite{Bell-Garland}.]
__global__ void
spmv_dia_kernel ( const int num_rows,
const int num_cols,
const int num_diags,
const int * offsets,
const float * data,
const float * x,
float * y )
{
int row = blockDim.x * blockIdx.x + threadIdx.x;
if ( row < num_rows ){
float dot = 0;
for ( int n = 0; n < num_diags; n++ ){
int col = row + offsets[ n ];
float val = data[ num_rows * n + row ];
if ( col >= 0 && col < num_cols )
dot += val * x[ col ];
}
y[ row ] += dot;
}
}
\end{lstlisting}
\label{Code:Diagonal-matrix-example}
\section{COO Kernel}
\begin{lstlisting}[caption= SpMV pseudocode using COO format for storing a matrix \cite{Parallel-Uppsala}.]
__global__ void
spmv_coo_kernel ( const int num_non_zero_elements,
const float * data,
const int * row,
const int * col,
const float * x,
float * y )
{
int i = blockDim.x * blockIdx.x + threadIdx.x;
if ( row < num_non_zero_elements )
y[ row[i] ] += data[i] * x[ col[i] ];
}
\end{lstlisting}
\section{ELL Oriented Kernels}
\subsection{ELL Kernel}
\begin{lstlisting}[caption = SpMV pseudocode using ELL format for storing a matrix from \textit{Efficient sparse matrix-vector multiplication on CUDA} \cite{Bell-Garland}.]
__global__ void
spmv_ell_kernel ( const int num_rows,
const int num_cols,
const int num_cols_per_row,
const int * indices,
const float * data,
const float * x,
float * y )
{
int row = blockDim.x * blockIdx.x + threadIdx.x;
if( row < num_rows ){
float dot = 0;
for ( int n = 0; n < num_cols_per_row; n++ ){
int col = indices[ num_rows * n + row ];
float val = data[ num_rows * n + row ];
if ( val != 0 )
dot += val * x[ col ];
}
y[ row ] += dot;
}
}
\end{lstlisting}
\begin{thebibliography}{1}
\bibitem{Bell-Garland}N Bell, M. Garland: \emph{Efficient sparse matrix-vector multiplication on CUDA}. NVIDIA Technical Report NVR-2008-004, NVIDIA Corporation, 1-32, 2008.
\bibitem{Parallel-Uppsala}D. Lukarski: \emph{Sparse Matrix-Vector Multiplication and Matrix Formats}. Parallel Algorithms for Scientific Computing, Uppsala University, 2013. \url{https://www.it.uu.se/education/phd_studies/phd_courses/pasc/lecture-1}
\end{thebibliography}
\end{document}
По какой-то причине ссылки на bibitem
s не определены, хотя никаких орфографических ошибок не обнаружено.
Чтобы даже правильно скомпилировать документ, если я откачу изменения, приведшие к ошибке, мне придется удалить файлы .aux
и .toc
.
Я в значительной степени тупой.
PS: Преамбула была создана профессором в качестве шаблона для использования всеми студентами, мне сказали не вмешиваться в нее.
[ПРАВКА]: Создан минимальный пример вывода той же ошибки, как и предлагалось.
[РЕДАКТИРОВАТЬ]: Добавлен файл журнала.
[ПРАВКА]: Удалены ссылка на GitHub, ссылка на полный проект и ссылка на файл журнала, так как они не нужны для ответа. Я размещу их вотдельная папкаи не удалю, если кто-то захочет посмотреть. Если по какой-то причине ссылки будут сломаны, пожалуйста, дайте мне знать, и я как-нибудь их обновлю, так как я также буду хранить резервную копию указанных файлов.
решение1
Решением этой проблемы стало обновление моего MiKTeX в режиме пользователя и администратора, как и сказал @UlrikeFischer:
Обновите свою систему tex - самое главное пакет листингов. С последней версией он снова работает. (Проверьте обновления в режиме пользователя и администратора).
Извините за кражу ответа, я просто хочу закрыть этот решенный вопрос и не спамить дальше, попросив написать комментарий в качестве ответа.
Если вы хотите, чтобы я принял ваш ответ, пожалуйста, ответьте в любое время, и я приму его в ответ.