- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i have the following programs:
// test.f90
program test
implicit none
integer::i
integer,dimension(100)::arr
!dir$ attributes offload:mic :: calc
real,external::calc
!dir$ omp offload target(mic)
!$omp parallel do
do i=1,100
arr(i)=calc(i)
end do
!$omp end parallel do
end program test
//test.c
#include <offload.h>
#pragma offload_attribute (target(mic))
float calc_(int *data)
{
return *data+1;
}
#pragma offload_attribute (target(none))
if i try to compile the test.c as "icc -c test.c", it says: "error: target not recognized". can you show me how to compile above to programs and run? thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Remove the following
#pragma offload_attribute (target(none))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Ravi. Also if I compile the test.f90 as "icc -c test.f90", it says "no action performed for file test.f90"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for fortran programs use ifort
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, I did "ifort -c test.f90", it says "the omp offload directive must be followed by one of the OpenMP directives parallel, parallel sections, or parallel do". Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To enable Openmp you need to add the option -openmp to the command line
ifort -c -openmp test.f90
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Ravi. Now, I renamed the test.f90 to test1.f90, after compiling I get "test1MIC.o" and "test1.o", also for test.c I get "testMIC.o" and "test.o". Now, how should I get the executable? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icc test.o test1.o
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your main is in Fortran, so as you noted create separate files (e.g. testC.c and testF.f90) then compile as follows:
icc -c -openmp testC.c
ifort -openmp testF.F testC.o
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Kevin and Ravi. Then where testCMIC.o and testFMIC.o will be used? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes.
In the future you will not see xxxMIC.o as they will be part of xxx.o
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thanks!!!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page