Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F84298301
hello.ptex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Sep 21, 23:11
Size
1 KB
Mime Type
text/x-c
Expires
Mon, Sep 23, 23:11 (2 d)
Engine
blob
Format
Raw Data
Handle
20983062
Attached To
R3683 Slides
hello.ptex
View Options
\documentclass[11pt,xcolor=dvipsnames]{beamer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyvrb}
\begin{python}{header}
from Slides.snippet_helper import Snippet, SnippetCollection
Snippet.default_output='latex'
# Snippet.default_line_numbering=True
\end{python}
\py{Snippet.getLatexStyleDefs()}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{python}{code}
snippet = Snippet(r"""
#include <mpi.h>
#include <stdio.h>
int main(int argc, char *argv[]){
int size, rank;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
printf("I’m process %d out of %d\n", rank, size);
MPI_Finalize();
}
""", compile_flag=True, format_flag=True,
include_paths=['/usr/lib/x86_64-linux-gnu/openmpi/include']
)
\end{python}
\begin{frame}[fragile]{Hello}
\py{snippet.pigment()}
\end{frame}
\begin{frame}[fragile]{Hello}
\py{snippet.pigment(line_numbering=True)}
\end{frame}
\begin{frame}[fragile]{Hello}
\py{snippet[5:11].pigment()}
\end{frame}
\begin{frame}[fragile]{Hello}
\py{snippet[5:11].pigment(keyword='MPI')}
\end{frame}
\end{document}
Event Timeline
Log In to Comment