Commit 17a62c14 authored by Roland Denis's avatar Roland Denis
Browse files

Merge branch 'fix_merge' into 'master'

Removing out-of-date files added in a previous merge.

See merge request !869
parents efcf9328 c42587c6
Pipeline #13234 passed with stages
in 1 minute and 59 seconds
Café Calcul : Tinker-HP
#######################
:date: 2020-12-10 10:00:00
:category: journee
:tags: fortran, gpu, hpc
:start_date: 2020-12-10
:end_date: 2020-12-10
:place: En ligne
:summary: Jean-Philip Piquemal présente le logiciel Tinker-HP
:inscription_link: https://indico.mathrice.fr/event/232/registration
.. section:: Description
:class: description
Jean-Philip Piquemal présentera le logiciel Tinker-HP qui offre un environnement de calcul haute performance pour la modélisation de systèmes complexes de millions d'atomes. Il s'agit d'un outil extrêmement rapide pour réaliser les simulations de dynamique moléculaire qui permettent de comprendre les mécanismes d'infection virale et notamment ceux du COVID-19. Ce logiciel, écrit en Fortran, est massivement parallèle et capable d'exploiter les architectures GPU. Pour plus d'informations, allez sur le site http://tinker-hp.ip2ct.upmc.fr
Cette présentation d'une durée de 30-40 minutes sera suivie d'une séance de questions.
Cette présentation sera accessible aux non-chimistes et aura lieu sur la plateforme BBB de Mathrice. Pour des raisons techniques nous sommes obligés de limiter le nombre de participants et nous vous demandons de bien vouloir vous inscrire.
Café Calcul : placement
#######################
:date: 2021-01-21 10:00:00
:category: journee
:tags: gpu, hpc
:start_date: 2021-01-21
:end_date: 2021-01-21
:place: En ligne
:summary: Emmanuel Courcelle présentera l'outil placement, développé au CALMIP.
:inscription_link: https://indico.mathrice.fr/event/244/registration
.. section:: Description
:class: description
Le placement de processus est essentiel à l'optimisation des
performances au moment de l'attribution des ressources sur un cluster
de calcul. Il est cependant parfois délicat, notamment dans le cas
de parallélisation avec des processus légers de bien suivre si les
processus s'exécutent bien suivant l'ordonnancement prévu. Cet outil
permet de faciliter cette étape et d'aider à sa validation. Il
permet également de vérifier que les GPUs sont effectivement utilisés
le cas échéant.
Placement est préconfiguré pour utilisation avec SLURM, mais il est
simple de l'adapter à un autre gestionnaire de travaux, et on peut
même l'utiliser sur un serveur en mode interactif. Il peut être
installé sans avoir les droits administrateur.
https://github.com/calmip/placement/wiki
from docutils.parsers.rst import directives, Directive
from docutils.parsers.rst.directives.parts import Contents
from docutils.transforms import frontmatter
from docutils.statemachine import StringList
from docutils import io, nodes
import dateutil.parser
from pelican import readers
from pelican.readers import PelicanHTMLTranslator
from pelican.utils import slugify
import re
from jinja2 import Template, Environment, FileSystemLoader
from textwrap import dedent
from logging import warning, debug
import os
# global variables needed to link the event and display the day
# just one time
num_day = 0
num_event = 0
# set locale in order to have french date for output string
import locale
locale.setlocale(locale.LC_TIME, "fr_FR.UTF-8")
def get_indico_event_as_schedule(url, event):
"""
Parse an indico event and return an rst like describing the schedule.
Parameters
----------
url: url
url of the indico
event: int
event number
Returns
-------
string: schedule of the event in a rst format
"""
from datetime import datetime, date, time
import maya
import collections
from urllib.request import urlopen
import json
try:
response = urlopen(url + '/export/timetable/' + str(event) + ".json").read()
except Exception as err:
warning(f"indico content could not be fetched for event n°{event} on {url}, no programme will be built. Offline ?")
warning(f"error was {err}")
return None
data = json.loads(response.decode('utf-8'))
schedule = {}
for day_k, day_v in data['results'][str(event)].items():
date = datetime.strptime(day_k, '%Y%m%d')
day = schedule.get(date, {})
for k, v in day_v.items():
start_time_str = v['startDate']['date'] + 'T' + v['startDate']['time'] + 'Z'
end_time_str = v['endDate']['date'] + 'T' + v['endDate']['time'] + 'Z'
start_time = maya.parse(start_time_str).datetime(to_timezone='Europe/Paris', naive=False)
end_time = maya.parse(end_time_str).datetime(to_timezone='Europe/Paris', naive=False)
day[start_time] = {
'start': start_time.strftime("%H:%M"),
'end': end_time.strftime("%H:%M"),
'type': v['entryType'],
'title': v['title'],
}
if v['entryType'] != 'Break':
speakers = []
if 'presenters' not in v.keys():
speakers.append("Orateur à confirmer")
elif v['presenters'] != []:
for person in v['presenters']:
speakers.append(person['firstName'].capitalize() + ' ' + person['familyName'].capitalize())
else:
speakers.append("Orateur à confirmer")
resources = []
for m in v['material']:
for mm in m['resources']:
resources.append(mm['url'])
day[start_time].update({
'description': v['description'].split('\n'),
'speaker': ', '.join(speakers),
'resources': resources,
})
schedule[date] = collections.OrderedDict(sorted(day.items()))
schedule = collections.OrderedDict(sorted(schedule.items()))
return get_indico_event_as_schedule.template.render(schedule=schedule)
# Pre-loading Jinja2 template as static variable
get_indico_event_as_schedule.template = Template(dedent("""
{%- for key, value in schedule.items() -%}
.. day:: {{ key.strftime("%d-%m-%Y") }}
{%- for vv in value.values() %}
{% if vv['type'] == 'Break' %}
.. break_event:: {{ vv['title'] }}
:begin: {{ vv['start'] }}
:end: {{ vv['end'] }}
{% else %}
.. event:: {{ vv['title'] }}
:begin: {{ vv['start'] }}
:end: {{ vv['end'] }}
:speaker: {{ vv['speaker'] }}
{%- if vv['resources'] %}
:support:
{%- for r in vv['resources'] %}
[support {{ loop.index }}]({{ r }})
{%- endfor -%}
{% endif %}
{% for p in vv['description'] %}
{{ p }}
{%- endfor -%}
{% endif -%}
{% endfor %}
{% endfor %}
"""))
# define new nodes
class schedule(nodes.General, nodes.Element):
""" schedule node """
class day(nodes.General, nodes.Element):
""" day node """
class event(nodes.General, nodes.Element):
""" event node """
class event_content(nodes.General, nodes.Element):
""" event content node """
class break_event(nodes.General, nodes.Element):
""" break event node """
class button(nodes.General, nodes.Element):
""" button node """
#define new directive
class Section(Directive):
"""
A section create
<div id="name" class="section">
<div class="container-fluid part *class>
<div class="block">
<h2 class="toc">/ name </h2>
<blockquote class="content">
...
</blockquote>
</div>
</div>
</div>
where class is an option in the directive.
This directive needs one argument which is the name of the section.
"""
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
option_spec = {
'class': directives.class_option,
}
has_content = True
def run(self):
self.assert_has_content()
# Slugigying section ids. The regexp:
# 1) removes non-word characters, non spaces, except for the hyphens,
# 2) removes leading spaces,
# 3) removes trailing spaces,
# 4) replaces successive spaces and hyphens by only one hyphen.
section = nodes.section(ids=[slugify(self.arguments[0],
[('[^\\w\\s-]', ''), ('(?u)\\A\\s*', ''), ('(?u)\\s*\\Z', ''), ('[-\\s]+', '-')])])
section['class'] = self.options.get('class', [])
section += nodes.title(self.arguments[0], self.arguments[0], classes=['toc'], refid=section['ids'][0])
blockquote = nodes.block_quote(classes=['content'])
section += blockquote
self.state.nested_parse(self.content, self.content_offset, blockquote)
s = section
return [s]
class Schedule(Directive):
required_arguments = 0
optional_arguments = 2
final_argument_whitespace = True
option_spec = {
'indico_url': directives.uri,
'indico_event': int,
}
has_content = True
def run(self):
global num_day, num_event
num_day = 0
num_event = 0
sche = schedule()
if self.content:
if 'indico_url' in self.options:
raise self.error(
'"%s" directive may not both specify an indico url '
'and have content.' % self.name)
self.state.nested_parse(self.content, self.content_offset, sche)
elif 'indico_url' in self.options:
if 'indico_event' not in self.options:
raise self.error(
'"%s" directive must contain the indico_event number '
'for the indico_url "%s" .' % (self.name, self.options['indico_url']))
source = self.options['indico_url']
event = self.options['indico_event']
content = get_indico_event_as_schedule(source, event)
if content != None: #we are online
content = content.split('\n')
self.state.nested_parse(StringList(content), len(content), sche)
else: # we are offline and nothing is fetched from indico
self.state.nested_parse(self.content, self.content_offset, sche)
else:
self.assert_has_content()
return [sche]
class Day(Directive):
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
option_spec = {}
has_content = True
def run(self):
global num_day
# Raise an error if the directive does not have contents.
self.assert_has_content()
d = day(classes=['day-color2' if num_day&1 else 'day-color1'])
d['num_day'] = num_day
d['day'] = dateutil.parser.parse(self.arguments[0], dayfirst=True)
d['show'] = True
self.state.nested_parse(self.content, self.content_offset, d)
num_day += 1
return [d]
def support_converter(s):
pattern = re.compile("\[(.*?)\]\((.*?)\)")
supports = list()
for line in s.splitlines():
matches = pattern.match(line)
if matches:
supports.append( {'name': matches.group(1), 'url': directives.uri(matches.group(2))} )
else:
supports.append( {'name': None, 'url': directives.uri(line)} )
return supports
class Event(Directive):
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
option_spec = {
'speaker': str,
'begin': str,
'end': str,
'support': support_converter
}
has_content = True
def run(self):
global num_event
node = event()
node['id'] = num_event
node['begin'] = dateutil.parser.parse(self.options['begin'])
node['end'] = dateutil.parser.parse(self.options['end'])
node['title'] = self.arguments[0]
node['speaker'] = self.options.get('speaker', None)
node['support'] = self.options.get('support', list())
node['content'] = '\n'.join(self.content)
content = event_content()
content['id'] = num_event
node += content
self.state.nested_parse(self.content, self.content_offset, content)
# text = '\n'.join(self.content)
# node['content'] = ''
# if text:
# admonition_node = nodes.Element(rawsource=text)
# self.state.nested_parse(self.content, self.content_offset,
# admonition_node)
# node += admonition_node
num_event += 1
return [node]
class Break(Directive):
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
option_spec = {
'begin': str,
'end': str,
}
has_content = False
def run(self):
global num_event
node = break_event()
node['id'] = num_event
node['begin'] = dateutil.parser.parse(self.options['begin'])
node['end'] = dateutil.parser.parse(self.options['end'])
node['break'] = self.arguments[0]
num_event += 1
return [node]
class Button(Directive):
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
has_content = False
option_spec = {'target': str,
'blank': bool,
}
def run(self):
node = button()
node['text'] = self.arguments[0]
node['target'] = self.options.get('target', None)
node['blank'] = self.options.get('blank', False)
return [node]
class ContentsHook(Contents):
""" Custom table of contents options """
def run(self):
# To avoid automatic 'id*' section backlinks generation (see #128)
self.options['backlinks'] = Contents.backlinks('none')
return super().run()
class myHTMLTranslator(PelicanHTMLTranslator):
def __init__(self, *args, **kwargs):
# Pre-loading Jinja2 templates
env = Environment(
loader=FileSystemLoader(os.path.dirname(__file__)+'/templates/'),
)
env.globals = {'isinstance': isinstance,
'day': day,
'len': len}
self.template = env.get_template('event.tpl')
super().__init__(*args, *kwargs)
def depart_section(self, node):
if node.hasattr('class') and self.section_level == 1:
self.body.append('</div>\n')
self.body.append('</div>\n')
super(myHTMLTranslator, self).depart_section(node)
def visit_section(self, node):
super(myHTMLTranslator, self).visit_section(node)
if node.hasattr('class') and self.section_level == 1:
self.body.append('<div class="container-fluid part {}">\n'.format(' '.join(node['class'])))
self.body.append('<div class="block">\n')
def depart_schedule(self, node):
self.body.append('</div>\n')
super().depart_section(node)
def visit_schedule(self, node):
super(myHTMLTranslator, self).visit_section(node)
self.body.append('<div class="schedule">\n')
def depart_day(self, node):
self.body.append('</div>\n')
def visit_day(self, node):
self.body.append('<div class="day %s">\n'%' '.join(node['classes']))
def depart_break_event(self, node):
pass
def visit_break_event(self, node):
self.body.extend(self.template.render(node=node, node_type='break').splitlines(True))
if (isinstance(node.parent, day) and node.parent['show']):
node.parent['show'] = False
def depart_event_content(self, node):
self.body.append('</div>\n')
self.body.append('</div>\n')
def visit_event_content(self, node):
self.body.append('<div id="collapseDetails%d" class="row collapse in pb-3">\n'%node['id'])
self.body.append('<div class="offset-md-3 col-md-9 event-content">\n')
def depart_event(self, node):
pass
def visit_event(self, node):
self.body.extend(self.template.render(node=node, node_type='speaker').splitlines(True))
if (isinstance(node.parent, day) and node.parent['show']):
node.parent['show'] = False
def visit_button(self, node):
self.body.append('<div class="savoirplus">\n')
if node['blank']:
self.body.append('<a href={} target="_blank" rel="noopener noreferrer">\n'.format(node['target']))
else:
self.body.append('<a href={}>\n'.format(node['target']))
self.body.append('<div class="detail-btn btn btn-outline-dark">\n')
self.body.append('{}\n'.format(node['text']))
def depart_button(self, node):
self.body.append('</div>\n')
self.body.append('</a>')
self.body.append('</div>\n')
def register():
directives.register_directive('section', Section)
directives.register_directive('schedule', Schedule)
directives.register_directive('event', Event)
directives.register_directive('event_content', Event)
directives.register_directive('break_event', Break)
directives.register_directive('day', Day)
directives.register_directive('button', Button)
directives.register_directive('contents', ContentsHook)
readers.PelicanHTMLTranslator = myHTMLTranslator
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment