- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello! I'm studying OpenMP on Jupiter examples. There is a simple task there:
%writefile lab/simple.cpp
//==============================================================
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
// =============================================================
#include <omp.h>
#include <iostream>
constexpr int N = 16;
int main() {
int is_cpu = true;
int *data = static_cast<int *>(malloc(N * sizeof(int)));
// Initialization
for (int i = 0; i < N; i++) data[i] = i;
#pragma omp target map(from:is_cpu) map(tofrom:data[0:N])
{
is_cpu = omp_is_initial_device();
#pragma omp parallel for
for (int i = 0; i < N; i++) {
data[i] *= 2;
}
}
// Print Output
std::cout << "Running on " << (is_cpu ? "CPU" : "GPU") << "\n";
for (int i = 0; i < N; i++) std::cout << data[i] << "\n";
free(data);
return 0;
}
# Execute this cell to compile the code
! chmod 755 compile_c.sh; ./compile_c.sh;
compile file:
#!/bin/bash
source /opt/intel/inteloneapi/setvars.sh > /dev/null 2>&1
echo "########## Compiling"
icpx -fiopenmp -fopenmp-targets=spir64 lab/simple.cpp -o bin/simple
echo "########## Done"
# Execute this cell to run the code
! chmod 755 q; chmod 755 run.sh;if [ -x "$(command -v qsub)" ]; then ./q run.sh; else ./run.sh; fi
q file:
#!/bin/bash
#==========================================
# Copyright © 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#==========================================
# Script to submit job in Intel(R) DevCloud
# Version: 0.7
#==========================================
if [ -z "$1" ]; then
echo "Missing script argument, Usage: ./q run.sh"
elif [ ! -f "$1" ]; then
echo "File $1 does not exist"
else
echo "Job has been submitted to Intel(R) DevCloud and will execute soon."
echo ""
echo " If you do not see result in 60 seconds, please restart the Jupyter kernel:"
echo " Kernel -> 'Restart Kernel and Clear All Outputs...' and then try again"
echo ""
script=$1
# Remove old output files
rm *.sh.* > /dev/null 2>&1
# Submit job using qsub
qsub_id=`qsub -l nodes=1:gpu:ppn=2 -d . $script`
job_id="$(cut -d'.' -f1 <<<"$qsub_id")"
# Print qstat output
qstat
# Wait for output file to be generated and display
echo ""
echo -ne "Waiting for Output "
until [ -f $script.o$job_id ]; do
sleep 1
echo -ne "█"
((timeout++))
# Timeout if no output file generated within 60 seconds
if [ $timeout == 60 ]; then
echo ""
echo ""
echo "TimeOut 60 seconds: Job is still queued for execution, check for output file later ($script.o$job_id)"
echo ""
break
fi
done
# Print output and error file content if exist
if [ -n "$(find -name '*.sh.o'$job_id)" ]; then
echo " Done⬇"
cat $script.o$job_id
cat $script.e$job_id
echo "Job Completed in $timeout seconds."
rm *.sh.*$job_id > /dev/null 2>&1
fi
fi
run.sh file:
#!/bin/bash
/bin/echo "##" $(whoami) is running OMP_Offload Module1 -- Intro to OpenMP offload - 1 of 1 simple.cpp/f90
echo "########## Executing"
cd bin
./simple
echo "########## Done"
It was all right, but at some point it began to throw these errors:
Libomptarget error: Unable to generate entries table for device id 0.
Libomptarget error: Failed to init globals on device 0
Libomptarget error: Run with
Libomptarget error: LIBOMPTARGET_DEBUG=1 to display basic debug information.
Libomptarget error: LIBOMPTARGET_DEBUG=2 to display calls to the compute runtime.
Libomptarget error: LIBOMPTARGET_INFO=4 to dump host-target pointer mappings.
Libomptarget error: Source location information not present. Compile with -g or -gline-tables-only.
Libomptarget fatal error 1: failure of target construct while offloading is mandatory
/var/spool/torque/mom_priv/jobs/1921701.v-qsvr-1.aidevcloud.SC: line 6: 334171 Aborted ./simple
Any ideas what is the problem?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Give it a try after some time this also happened to me. I tried after some time in Dev cloud, and it worked. Inform, if the error still persists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried it.Is it working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We have tried to run the program on devcloud. we had successfully run the program at our end. Could you please try again on devcloud and let us if you are facing any issues?
Thanks & Regards,
Hemanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We assume that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Thanks & Regards,
Hemanth
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page