To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit c4b322eb authored by Donjan Rodic's avatar Donjan Rodic

added euler demo

parent 54f25445
To compile on Euler:
module load gcc
g++ cputest.cpp -o cputest
To submit the executable:
bsub -W 00:10 -n 1 ./cputest
To submit the script that runs the executable:
bsub -W 00:10 -n 1 < script
/* Simple cpu code that prints the hostname of the current node */
#include <stdio.h>
#include <unistd.h>
#include "timer.hpp"
int main(int argc, char *argv[])
{
char name[256];
timer t;
t.start();
gethostname(name, 256);
sleep(1);
t.stop();
printf("Hello, I am running on host: %s\n", name);
printf("Elapsed time = %lf seconds\n", t.get_timing());
return 0;
}
Sender: LSF System <lsfadmin@e1138>
Subject: Job 28539824: <./cputest> in cluster <euler> Done
Job <./cputest> was submitted from host <euler04> by user <chatzidp> in cluster <euler>.
Job was executed on host(s) <e1138>, in queue <normal.4h>, as user <chatzidp> in cluster <euler>.
</cluster/home/chatzidp> was used as the home directory.
</cluster/home/chatzidp/Euler_demo> was used as the working directory.
Started at Thu Sep 22 23:06:10 2016
Results reported on Thu Sep 22 23:06:12 2016
Your job looked like:
------------------------------------------------------------
# LSBATCH: User input
./cputest
------------------------------------------------------------
Successfully completed.
Resource usage summary:
CPU time : 0.01 sec.
Total Requested Memory : 1024.00 MB
Delta Memory : -
(Delta: the difference between Total Requested Memory and Max Memory.)
The output (if any) follows:
Hello, I am running on host: e1138
Elapsed time = 1.000075 seconds
Sender: LSF System <lsfadmin@e1258>
Subject: Job 28539861: <echo $HOSTNAME;echo "I am here";./cputest> in cluster <euler> Done
Job <echo $HOSTNAME;echo "I am here";./cputest> was submitted from host <euler04> by user <chatzidp> in cluster <euler>.
Job was executed on host(s) <e1258>, in queue <normal.4h>, as user <chatzidp> in cluster <euler>.
</cluster/home/chatzidp> was used as the home directory.
</cluster/home/chatzidp/Euler_demo> was used as the working directory.
Started at Thu Sep 22 23:06:56 2016
Results reported on Thu Sep 22 23:06:58 2016
Your job looked like:
------------------------------------------------------------
# LSBATCH: User input
echo $HOSTNAME
echo "I am here"
./cputest
------------------------------------------------------------
Successfully completed.
Resource usage summary:
CPU time : 0.01 sec.
Total Requested Memory : 1024.00 MB
Delta Memory : -
(Delta: the difference between Total Requested Memory and Max Memory.)
The output (if any) follows:
e1258
I am here
Hello, I am running on host: e1258
Elapsed time = 1.000071 seconds
echo $HOSTNAME
echo "I am here"
./cputest
// Timer for the HPCSE I course
//
#ifndef HPCSE16_TIMER_HPP
#define HPCSE16_TIMER_HPP
#include <sys/time.h>
class timer {
public:
timer() {
start_time.tv_sec = 0;
start_time.tv_usec = 0;
stop_time.tv_sec = 0;
stop_time.tv_usec = 0;
}
inline void start() {
gettimeofday(&start_time, NULL);
}
inline void stop() {
gettimeofday(&stop_time, NULL);
}
double get_timing() const {
return (stop_time.tv_sec - start_time.tv_sec) + (stop_time.tv_usec - start_time.tv_usec)*1e-6;
}
private:
struct timeval start_time, stop_time;
};
#endif //HPCSE16_TIMER_HPP
Markdown is supported
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