Skip to content

Commit

Permalink
generated using sphinx-build
Browse files Browse the repository at this point in the history
  • Loading branch information
workflow-bot committed Feb 14, 2024
0 parents commit 16b5181
Show file tree
Hide file tree
Showing 812 changed files with 164,787 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .ci/linkchecker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# We ignore ANSYS CFX and Fluent links as they give
# https://github.com/curl/curl/issues/4409, which needs a
# rather new version of OpenSSL.
# The cytopia/linkcheck is rather slow. There are faster alternatives,
# especially https://github.com/filiph/linkcheck, but that
# requires Dart etc.
# Consider to utilize a faster link checker as soon as we have
# all the exclude links configured and it works.
git clone https://github.com/cytopia/linkcheck.git /tmp/linkchecker && /tmp/linkchecker/linkcheck -i '^http(s)?:\/\/(localhost)|(127.0.0.1)|(documentation.sigma2.no/page/on/same/site.html)|(download.open-mpi.org/release/open-mpi/v4.0/openmpi-)|(example.org/institution/simulationDataq)|(rt.uninett.no/SelfService)|(desktop.saga.sigma2.no)|(desktop.fram.sigma2.no)|(example.org/institution/simulationData)|(www.pythonware.com/products/pil)|(www.linuxconfig.org/Bash_scripting_Tutorial)|(https://documentation.sigma2.no/_downloads/bdfbca90a90a8d1b824fc6b1154ceee7/serial.zip)|(https://www.ansys.com/products/fluids/ansys-cfx)|(https://www.ansys.com/products/fluids/ansys-fluent)' -e 'md,txt,rst' -k -c '200,301,302,303,307,308' .
41 changes: 41 additions & 0 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build HTML

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install Python dependencies
run: |
python -m pip install -r requirements.txt
- name: Run Sphinx
run: |
sphinx-build . _build
- name: Commit and push to gh-pages
run: |-
git config --global user.email "[email protected]"
git config --global user.name "workflow-bot"
git checkout --orphan gh-pages
git rm --cached -r .
mv CNAME _build ..
rm -rf *
mv ../_build/* .
mv ../CNAME .
touch .nojekyll
git add .
git commit -m "generated using sphinx-build"
git push --set-upstream origin gh-pages --force
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# vim temporary files
.*.swp
.*.swo

# macOS
.DS_Store

# sphinx
_build/
venv/
37 changes: 37 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
stages:
- linkchecker
- spellchecker
- build

image: python:3.10-alpine

linkchecker:
stage: linkchecker
only:
- schedules
script:
- apk add --no-cache git bash curl
- bash .ci/linkchecker.sh

spellchecker:
stage: spellchecker
script:
- apk add --no-cache bash curl
- curl -L -o ./install-misspell.sh https://git.io/misspell
- bash ./install-misspell.sh
- ./bin/misspell -error .

build:
stage: build
when: on_success
script:
- pip install --upgrade pip
- pip install -r requirements.txt
# '-W': Turn warnings into errors
# '--keep-going': When encountering a warning continue to process (this
# allows us to capture multiple warnings at the same time, avoiding the
# 'build->warning->fix->build->warning' loop where both fixes could be
# solved at the same time)
# '-n': Warn about internal missing references
- sphinx-build -W --keep-going -n . _build
Empty file added .nojekyll
Empty file.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
documentation.sigma2.no
155 changes: 155 additions & 0 deletions _downloads/0105ae9db861b5434b03f0f2ee915de4/mandelbrot_initial.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/**
* Mandelbrot implementation for accelerators (e.g. GPUs)
*/

#include "utils/lodepng.h"
#include "utils/palette.h"
#include <omp.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// Default width and height for image if not given
static const int WIDTH = 1280;
static const int HEIGHT = 720;
// Default output name if not given
static const char* OUTPUT_NAME = "mandelbrot.png";
// Maximum iteration count before exiting mandelbrot function
static const uint32_t MAX_ITER = 1000;

// Helper function to scale 'num' to the range '[min, max]'
#pragma acc routine seq
float scale(float num, const float min, const float max) {
const float scale = max - min;
return num * scale + min;
}

/**
* Mandelbrot function, calculates the value of the mandelbrot set at pixel 'px/py'
*/
#pragma acc routine seq
uint32_t mandelbrot(const int px, const int py, const int width, const int height,
const int max_iter) {
const float x0 = scale((float) px / (float) width, -2.5, 1.);
const float y0 = scale((float) py / (float) height, -1., 1.);
float x = 0.;
float y = 0.;
float x2 = 0.;
float y2 = 0.;
int iters = 0;
while (x2 + y2 < 4. && iters < max_iter) {
y = 2. * x * y + y0;
x = x2 - y2 + x0;
x2 = x * x;
y2 = y * y;
iters += 1;
}
return (uint32_t) iters;
}

int main (int argc, char** argv) {
int width = WIDTH;
int height = HEIGHT;
char output_name[128];
int max_iter = MAX_ITER;
strncpy (output_name, OUTPUT_NAME, strnlen (OUTPUT_NAME, 127) + 1);
// Assume the first argument is the width and height of the image
if (argc > 1) {
if (strncmp (argv[1], "-h", 2) == 0 || strncmp (argv[1], "--help", 6) == 0) {
printf("Usage: %s <width>x<height> <max iterations> <output filename>\n", argv[0]);
printf("\tImage size can also be one of {8k, 4k, 3k, 1080p, 720p}\n");
return EXIT_SUCCESS;
}
// First we check image size is one of the predefined sizes
if (strncmp (argv[1], "8k", 2) == 0) {
width = 7680;
height = 4320;
} else if (strncmp (argv[1], "4k", 2) == 0) {
width = 3840;
height = 2160;
} else if (strncmp (argv[1], "3k", 2) == 0) {
width = 3000;
height = 2000;
} else if (strncmp (argv[1], "1080p", 5) == 0) {
width = 1920;
height = 1080;
} else if (strncmp (argv[1], "720p", 4) == 0) {
width = 1280;
height = 720;
} else {
// Assume user has supplied <width>x<height>
// Try to find 'x' in argument
char* token;
token = strtok (argv[1], "x");
if (token != NULL) {
width = atoi (token);
} else {
printf("\033[0;31mInvalid width/height definition:\033[0m '%s'\n", argv[1]);
printf("\tShould be '<width>x<height>'\n");
return EXIT_FAILURE;
}
token = strtok (NULL, "x");
if (token != NULL) {
height = atoi (token);
} else {
printf("\033[0;31mInvalid width/height definition:\033[0m '%s'\n", argv[1]);
printf("\tShould be '<width>x<height>'\n");
return EXIT_FAILURE;
}
}
}
// Second argument is the maximum iteration count
if (argc > 2) {
max_iter = atoi (argv[2]);
}
// Third argument is the output filename to write PNG file to
if (argc > 3) {
if (strlen (argv[3]) > 127) {
printf("\033[0;31mOutput filename to large!\033[0m");
return EXIT_FAILURE;
}
strncpy (output_name, argv[3], strnlen (argv[3], 127) + 1);
}
// Allocate storage for image
uint32_t* image = calloc (width * height, sizeof (uint32_t));
if (image == NULL) {
printf("\033[0;31mCould not allocate memory for image!\033[0m\n");
return EXIT_FAILURE;
}
printf("Generating \033[0;35m%dx%d\033[0m image with max \033[0;35m%d\033[0m iterations\n",
width, height,
max_iter);
/****************************************************************************/
/*************************** Main computation ***************************/
/****************************************************************************/
const double start_time = omp_get_wtime ();
// For each pixel of our image calculate the value of the mandelbrot set
#pragma acc parallel loop \
copyout(image[:width * height]) \
copyin(palette[:palette_size]) \
collapse(2)
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
const uint32_t iters = mandelbrot (x, y, width, height, max_iter);
image[y * width + x] = palette[iters % palette_size];
}
}
const double end_time = omp_get_wtime ();
printf("Used \033[0;35m%.3f\033[0m ms for computation\n",
(end_time - start_time) * 1000.0);
/****************************************************************************/
// Write image to file
const unsigned char png_error = lodepng_encode32_file(output_name,
(const unsigned char*) image,
width, height);
// Free image storage
free (image);
if (png_error) {
printf("\033[0;31mAn error occurred while writing to PNG:\033[0m %s\n",
lodepng_error_text (png_error));
return EXIT_FAILURE;
}
printf("Wrote Mandelbrot result to \033[0;35m%s\033[0m\n", output_name);
return EXIT_SUCCESS;
}
65 changes: 65 additions & 0 deletions _downloads/0222d30f6733c67f4afcb6e626b30824/saga_mpi_job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

###############################################
# Script example for a normal MPI job on Saga #
###############################################

## Project: replace XXXX with your project ID
#SBATCH --account=nnXXXXk

## Job name:
#SBATCH --job-name=MyJob
## Number of tasks (aka processes) to start: Pure mpi, one cpu per task
#SBATCH --ntasks=16
## Amount of memory per cpu (= per task, since we get 1 cpu per task):
#SBATCH --mem-per-cpu=4G
## Run for 10 minutes, syntax is d-hh:mm:ss
#SBATCH --time=0-00:10:00

# you may not place bash commands before the last SBATCH directive
######################################################
## Setting variables and prepare runtime environment:
##----------------------------------------------------
## Recommended safety settings:
set -o errexit # Make bash exit on any error
set -o nounset # Treat unset variables as errors

# Loading Software modules
# Allways be explicit on loading modules and setting run time environment!!!
module --quiet purge # Restore loaded modules to the default
module load MySoftWare/Versions #nb: Versions is important!

# Type "module avail MySoftware" to find available modules and versions
# It is also recommended to to list loaded modules, for easier debugging:
module list

#######################################################
## Prepare jobs, moving input files and making sure
# output is copied back and taken care of
##-----------------------------------------------------

# Prepare input files
cp inputfiles $SCRATCH
cd $SCRATCH

# Make sure output is copied back after job finishes
savefile outputfile1 outputfile2

########################################################
# Run the application, and we typically time it:
##------------------------------------------------------

# Run the application - please add hash in front of srun and remove
# hash in front of mpirun if using intel-toolchain

# For OpenMPI (foss and iomkl toolchains), srun is recommended:
time srun MySoftWare-exec

## For IntelMPI (intel toolchain), mpirun is recommended:
#time mpirun MySoftWare-exec

#########################################################
# That was about all this time; lets call it a day...
##-------------------------------------------------------
# Finish the script
exit 0
Loading

0 comments on commit 16b5181

Please sign in to comment.