Software Archive
Read-only legacy content
17061 Discussions

dlopen() failed

Dean_B_
Beginner
534 Views

I am trying to get console output from an offloaded program. Here is a c++ versions that works:

#include <stdio.h> __declspec(target(mic)) int myprint() {  printf("hello from mic c++ version\n");  return(0); }

int main() {  int i;     __declspec(target(mic)) int myprint();

    #pragma offload target(mic)     i=myprint(); }

The above program yields the expected output:

hello from mic c++ version Press any key to continue . . .

 

Here is a putative fortran version

!DIR$ ATTRIBUTES OFFLOAD:mic :: myprint subroutine myprint()    print *, "hello from mic fortran version" end subroutine myprint        program main !DIR$ ATTRIBUTES OFFLOAD:mic :: myprint !DIR$ OFFLOAD target(mic)    call myprint() end program main   

It does not work! Produces the following output:

On the remote process, dlopen() failed. The error message sent back from the sin k is /var/volatile/tmp/coi_procs/1/4976/load_lib/oct31MIC.out: undefined symbol:  for_write_seq_lis On the sink, dlopen() returned NULL. The result of dlerror() is "/var/volatile/t mp/coi_procs/1/4976/load_lib/oct31MIC.out: undefined symbol: for_write_seq_lis" offload error: cannot load library to the device 0 (error code 20) Press any key to continue . . .

I also get a simular error if I attempt to open and write a file in offloaded fortran code.

I need to implement my project in fortran any help to resolve this will be greatly appreciated.

0 Kudos
1 Reply
Kevin_D_Intel
Employee
534 Views

Both small examples should run successfully and are for me on Linux and Windows.

What ifort compiler did you use and what compiler options (if any)?

Here's the Fortran case details:

$ cat -n test.f90
     1  !DIR$ ATTRIBUTES OFFLOAD:mic :: myprint
     2  subroutine myprint()
     3      print *, "hello from mic fortran version"
     4  end subroutine myprint
     5
     6  program main
     7  !DIR$ ATTRIBUTES OFFLOAD:mic :: myprint
     8  !DIR$ OFFLOAD target(mic)
     9      call myprint()
    10  end program main

On Linux:
$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.1.106 Build 20131008
  
$ ifort test.f90 ; ./a.out
 hello from mic fortran version

On Windows:
C:\>ifort test.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.1.137 Build 20131008
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
 
Microsoft (R) Incremental Linker Version 11.00.60315.1
Copyright (C) Microsoft Corporation.  All rights reserved.
 
-out:test.exe
-subsystem:console
test.obj
C:\Temp\2\35244.obj
-defaultlib:liboffload
-defaultlib:libiomp5md
ofldbegin.obj
ofldend.obj
 
C:\>.\test.exe
 hello from mic fortran version

0 Kudos
Reply