16

Is it possible to load pdflatex on both dualcore-cores of my Intel Core2Duo-Processor? At the moment, pdflatex just uses one core while the second core stays idle.

I got a pretty big document of 200 pages with many non-eps-pictures included...

Thanks a lot in advance!

Hendrik Vogt
  • 37,935
  • [3 years later] Since this question has been considered a duplicate in http://tex.stackexchange.com/questions/136658/how-to-make-pdflatex-multithreaded-when-shell-scape-is-enabled, I would like to point out that documents relying on tikz and either external lib or standalone package may benefit from multiple cores. Perhaps answers should be tracked under the linked question. – Christian Feuersänger Oct 06 '13 at 14:16

1 Answers1

17

TeX works in a linear way, with little or no room for parallellization. Besides that, pdflatex is written in a single-threaded fashion, so that won't be an option.

There are several options to speed-up building times:

  1. draft does exactly what you expect from it, it produces a draft document: images are excluded, microtype is disabled, ...
  2. you can use subfiles or subdocs (both clickable) to only rebuild the relevant parts of your document
  3. comment sections you're not adapting at that moment
Pieter
  • 5,411
  • 5
    The linear nature of the typesetting process is the key: you can't start typesetting at the beginning and middle of a file at the same time! – Joseph Wright Nov 17 '10 at 12:17
  • That's true, but I've always felt that it could be possible to do two passes: one to do all macro expansions and collect figures / pictures / tikz, then parse those in parallel and in a second pass actually process / typeset all the actual text. But what the possible benefit could be, I don't know, optimization without benchmarking first is useless, so I don't know the actual bottlenecks. And there are probably issues with this idea :). – Pieter Nov 17 '10 at 12:37
  • 1
    @Pieter: You're falling into the trap of thinking of TeX macros as similar to, for example, C ones. In TeX, you cannot expand the macros without reference to what else is going on (see category codes, verbatim text, etc.). So a scheme as you suggest is fundamentally not possible with the TeX model – Joseph Wright Nov 17 '10 at 12:40
  • That's why my first pass is expansion in a linear fashion, as it happens right now. But certain steps (for instance: including an image, which requires information on its dimensions) aren't performed yet, just the state at that moment is saved. Then those saved states are processed in parallel, modulo a dependency check. – Pieter Nov 17 '10 at 12:45
  • @Pieter: In doesn't happen in a liner fashion. The expansion of any particular macro depends on the preceding material. So you cannot do 'first expand, then process'. – Joseph Wright Nov 17 '10 at 13:13
  • 1
    Certain actions that can be guaranteed to have no side effects (e.g. including a picture stream whose size is already known, embedding fonts, etc.) could indeed be parallelized. However, that would require a complete rewrite of the TeX program (which is written in a very idiosyncratic way, with many global variables etc.), something that AFAIK not even the LuaTeX team plans. – Philipp Nov 17 '10 at 13:56
  • @Philipp: Quite apart from the technical questions about such an approach, I wonder how useful it would be on a practical level. The amount of work to do for the tasks which you point out could be put into a second thread is not necessarily a large part of the typesetting process. So there could be a lot of work for little actual gain. – Joseph Wright Nov 17 '10 at 14:58
  • Breaking up my large files into multiple small files is absolutely key to my LaTeX sanity. Generally, I have a seperate folder for figures, equations, proofs, sometimes sections. I don't use the subfile package, I just keep a harness.tex file which shares a preamble with the main file, and \input the file I'm working on. Saves me much time and aggravation, and makes using a VCS much more useful. It's also easier to reuse equations and so forth between documents. – philosodad Nov 17 '10 at 16:20
  • There's plenty of room for parallelization with any "shell-escape" commands. – Neil G Apr 22 '15 at 22:38