Fortran pointer
Author: g | 2025-04-23
Fortran function: pointer as actual argument and target as formal. 4. Nullifying Pointers in Fortran. 2. array of pointers fortran. 2. passing pointer arguments in fortran. 2. Pass pointer of child type to dummy argument that takes a pointer of parent class. 2. Fortran pointer to parameter array target. 3.
Understanding Fortran pointers - Help - Fortran Discourse
PROCEDURE statement in the derived type declaration, the developer can make the "this" argument to be second, third, or wherever appropriate on the dummy argument list; it doesn't have to be first. Also, the argument can be named "this", "self", "me", etc. - whatever naming convention is preferred. Izaak Beekman wrote:...If one were to give the TBP/procedure-pointer component the nopass attribute then the procedure could be invoked explicitly passing the object: obj%method(obj). ...In such a case, the invocation becomes analogous to that of a conventional Fortran subprogram: CALL method(obj,..) in the case of a subroutine and foo = method(obj,..) for a function. Izaak Beekman wrote:Yeah, how they arrived at some of the finer points of the syntax for procedure pointer components really seems non-intuitive to me.Things start to make a little bit of sense to me when I consider what would be required for consistency with legacy FORTRAN. I assume that is what the Fortran 2003 standard writers had to contend with, trying to add new features while retaining syntax that, at a base level, is not alien to how it has been done since FORTRAN IV perhaps, or definitely FORTRAN 77. Considering all the constraints that any standards body would normally face and when one piles all the legacy stuff on top of it, I think Fortran 2003 creators did a remarkable job. But for many Fortran 2003 and 2008 features, I don't think I'll be writing any new code in Fortran! Thank you all for enlightening discussions on this subject. The code provided by FortranFan works like a charm. I have to admit that I would have never be able guess the correct syntax in this case, regardless of the modern FORTRAN bibliography worldwide available. The most puzzling for me is the presence of 'this' at lines 4, 8 and 12.RakFortranFan wrote:Quote:jimdempseyatthecove wrote: ... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface? ... Jim,Is the functionality shown in the code below what you're asking about? It is standard Fortran. module pcf_mod type ::
Pointers / Free Literature on Fortran - Fortran Discourse
Type related lines it compiles fine. It seems that I am stuck.Rak As you found out, you have to use a derived type here. Fortran doesn't have the notion of an array of pointers.The new error is simply a compiler bug. For some reason it thinks you're declaring a type-bound procedure, which you aren't. That's just weird - I will report it to the developers. Steve Lionel (Intel) wrote:The new error is simply a compiler bug. For some reason it thinks you're declaring a type-bound procedure, which you aren't. That's just weird - I will report it to the developers.Steve, according to Fortran 95/2003 by M,R,C this is correct behavior: When a procedure pointer component (or a type-bound procedure, Section 16.6) is invoked the object through which it is invoked is normally passed to the procedure as its first actual argument and the items in the parenthesized list are the other actual arguments. This could be undesirable; for instance, it might be wished to pass the object to a dummy argument other than the first or not to pass it at all.Therefore, I don't think this is a compiler bug. For the OP to get the intended behavior, simply add the nopass attribute to the procedure pointer declaration in the derived type: type :: ARRPROCPOINTER procedure(USERFUNC_int), pointer, nopass :: pcf end type ARRPROCPOINTER Well, I'll be darned. I'm always learning something new about this language.... Indeed you are correct, Zaak. Yeah, how they arrived at some of the finer points of the syntax for procedure pointer components really seems non-intuitive to me. Zaak,Assuming the nopass technique corrects the compiler complaint of compliance to the standard... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface?Jim Dempsey jimdempseyatthecove wrote:Zaak,Assuming the nopass technique corrects the compiler complaint of compliance to the standard... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface?Jim DempseyJim, I'm not sure what you mean by the "this" pointer. If the userFortran pointers, and aliasing - Help - Fortran Discourse
ROCHESTER HILLS, Mich., Aug. 11, 2004 (PRIMEZONE) -- Absoft Corporation has announced immediate availability of its new high performance Pro Fortran tool kit version 9.0 for Macintosh OS X. Absoft's Pro Fortran Compiler Suite is the most complete Macintosh Fortran tool kit available from any vendor and includes: Fortran 95 and C/C++ compilers, a powerful Integrated Development Environment, the market-leading Fx2(tm) Debugger, and free graphics libraries. Pro Fortran is fully compatible with Panther, all Apple tools and libraries and is specially optimized for the G5 processor.The Absoft Pro Fortran Compiler Suite for Macintosh OS X is the world's most popular Fortran tool kit for OS X and is the only environment designed specifically for creating and maintaining Fortran and C/C++ applications on Macintosh systems. Absoft's powerful and flexible Integrated Development Environment (IDE) is included at no additional charge with all versions of Pro Fortran for Macintosh (and Windows). The Absoft IDE is a stand-alone tool suite that provides graphical interfaces for multiple compilers for OS X (Pro Fortran, IBM XL Fortran, IBM XL C/C++, and gcc) and select third party tools and libraries (VAST, IMSL, 2D/3D graphics, LAPACK90)."Pro Fortran v9.0 for Macintosh OS X is Absoft's best release ever," said Wood Lotz, President of Absoft. "This exciting new tool suite includes across-the-board improvements for all components - the compiler includes new Fortran 2003 features and generates up to 25% faster code, Fx2, the leading Fortran debugger is now included and now supports the IBM XL compilers. Further, this release includes an improved editor and the only IDE available for Mac OS X which supports compilers from multiple vendors (Absoft, IBM and gnu) and select third party tools.""Absoft leads the industry in price/performance solutions with fast, reliable compilers, flexible licensing policies, powerful debugging and development tools, and free technical support," continued Lotz. "Absoft is the only company offering source compatible Fortran compilers for all of today's leading computing platforms running Windows, OS X, and Linux. This compatibility is important for users such as universities and labs who work in multiple environments," added Lotz. "Our powerful and unique combination of superior performance,. Fortran function: pointer as actual argument and target as formal. 4. Nullifying Pointers in Fortran. 2. array of pointers fortran. 2. passing pointer arguments in fortran. 2. Pass pointer of child type to dummy argument that takes a pointer of parent class. 2. Fortran pointer to parameter array target. 3. Fortran structures and pointers. 1. One pointer for different types Fortran. 1. Fortran: Type containing a member that is an array of elements of this type. 4. Fortran polymorphism in pointers. 3. Fortran pointer attribute to type declarations. 2. How to use structures with pointers in Fortran like in C? 3.Ownership for Fortran pointers - Language enhancement - Fortran
Hi,I am trying to construct a static array of procedure pointers like this: abstract interface function USERFUNC_int (arg) integer USERFUNC_int integer, intent(IN) :: arg end function USERFUNC_int end interface procedure(USERFUNC_int), pointer :: pcfs(100) but the compiler complains about the "(":error #5082: Syntax error, found '(' when expecting one of: , ; => procedure(USERFUNC_int), pointer :: pcfs(100)It is possible to declare a static array of procedure pointers? I am using ifort 13.1.3.0.Thanks,Rak Intel® Fortran Compiler 1 Solution jimdempseyatthecove wrote:... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface?...Jim,Is the functionality shown in the code below what you're asking about? It is standard Fortran. module pcf_mod type :: ARRPROCPOINTER procedure(USERFUNC_int), pointer, pass(this) :: pcf end type ARRPROCPOINTER abstract interface function USERFUNC_int (arg, this) import :: ARRPROCPOINTER integer USERFUNC_int integer, intent(IN) :: arg class(ARRPROCPOINTER) :: this end function USERFUNC_int end interface type(ARRPROCPOINTER) :: pcfs(100) end module pcf_mod program p .. integer :: i, j, k .. pcfs(i)%pcf => foo .. k = pcfs(i)%pcf(j) .. end program pNote how the interface has been changed to refer to the invoking object via the "this" dummy argument. You may also know that by using the PASS attribute in the PROCEDURE statement in the derived type declaration, the developer can make the "this" argument to be second, third, or wherever appropriate on the dummy argument list; it doesn't have to be first. Also, the argument can be named "this", "self", "me", etc. - whatever naming convention is preferred. All forum topics Previous topic Next topic 13 Replies Moreover, if I am trying to circumvent the problem by embedding the function pointer into a derived type as follows module pcf_mod abstract interface function USERFUNC_int (arg) integer USERFUNC_int integer, intent(IN) :: arg end function USERFUNC_int end interface type :: ARRPROCPOINTER procedure(USERFUNC_int), pointer :: pcf end type ARRPROCPOINTER type(ARRPROCPOINTER) :: pcfs(100) end module pcf_modI am getting a totally unrelated compiler error:error #8262: The passed-object dummy argument must be dummy data object with the same declared type as the type being defined. [ARG] function USERFUNC_int (arg)Removing thePointers in Fortran - Stack Overflow
Did want to pass the object as an actual argument to type bound procedure (TBP) or procedure being pointed to by the procedure pointer component, then the canonical way of doing this is to specify the first dummy argument of the procedure as being type-compatible with the encompassing "this" object and without adding any pass or nopass attributes to the component specification. If the procedure had only this one dummy argument, then when it is invoked via the TBP or procedure-pointer component, the encompassing object is implicitly passed as the first actual argument, and the user can invoke the procedure with no (explicit) actual arguments. e.g., obj%method(). If one were to give the TBP/procedure-pointer component the nopass attribute then the procedure could be invoked explicitly passing the object: obj%method(obj). These two scenarios are identical. In general I think explicit is better than implicit, but in this context it is reasonable to expect a procedure bound to an object to modify the objects state and appreciate the decrease in verbosity associated with this language feature.So, if I correctly understand your question, the answer is 'yes.' At any rate, between this post and Fortran Fan's hopefully we've covered the ins and outs of the pass(_____) and nopass attribute, and objects implicitly or explicitly passed as actual arguments to their TBPs/procedure-pointer components. jimdempseyatthecove wrote:... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface?...Jim,Is the functionality shown in the code below what you're asking about? It is standard Fortran. module pcf_mod type :: ARRPROCPOINTER procedure(USERFUNC_int), pointer, pass(this) :: pcf end type ARRPROCPOINTER abstract interface function USERFUNC_int (arg, this) import :: ARRPROCPOINTER integer USERFUNC_int integer, intent(IN) :: arg class(ARRPROCPOINTER) :: this end function USERFUNC_int end interface type(ARRPROCPOINTER) :: pcfs(100) end module pcf_mod program p .. integer :: i, j, k .. pcfs(i)%pcf => foo .. k = pcfs(i)%pcf(j) .. end program pNote how the interface has been changed to refer to the invoking object via the "this" dummy argument. You may also know that by using the PASS attribute in theFORTRAN 90: POINTERS - gatech.edu
Free Download Approximatrix Simply Fortran 3.39.4394 Full Version - A powerful and comprehensive editor for Fortran language.Free Download Approximatrix Simply Fortran full version standalone offline Windows installer is a powerful and comprehensive editor for Fortran language.Overview of Approximatrix Simply FortranThis is a powerful and comprehensive editor software for the Fortran programming language. This software is known as a complete and reliable Fortran compiler, utilizing the necessary productivity tools that experts need.The software package in front of you includes a configured Fortran compiler and an integrated development environment, including an integrated debugging set of other development needs.Moreover, you will have access to a powerful editor using the Simply Fortran product. This way, you can manage your projects professionally using the software. This means that this software can manage and edit your projects better than ever, given its professional capabilities.Features of Approximatrix Simply FortranBenefit from a simple Windows startup pageAbility to create and display types of charts, bars, or two-dimensional chartsBenefit from AppGraphics library in Windows versionFull support for this software from OpenMPQuick Search in Windows allows you to do thisSupport for Syntax Legacy and Modern FortranTechnical Details and System RequirementsSupported OS: Windows 11, Windows 10, Windows 8.1, Windows 7RAM (Memory): 2 GB RAM (4 GB recommended)Free Hard Disk Space: 200 MB or morePrevious versionFile Name:Approximatrix Simply Fortran 3.39.4385Version:3.39.4385File Name:Approximatrix Simply Fortran 3.38.4350Version:3.38.4350File Name:Approximatrix Simply Fortran 3.38.4338Version:3.38.4338File Name:Approximatrix Simply Fortran 3.37.4300Version:3.37.4300CommentsFortran Pointer as argument in a subroutine
Subject to license terms and policies of their respective manufacturers. Please contact Absoft directly for further details or questions on Technical Support or Software Maintenance. Disclaimer: Premier Technical Support cannot be used as a tutorial to assist in the design and development of applications, use of programs in other than their specified operating environment, provide instructions on general system operation or explore failures caused by products for which Absoft is not responsible under this agreement. MaxFlex· Flexible Licensing available: Yes Floating Network Licenses available: Yes Copy and use on home/portable computer: Yes. Absoft's no charge companion home license policy allows registered users to install Fortran 95 on their home system at no additional charge. Volume orders: Yes. Contact Absoft sales directly. Back to top Recommended Minimum Pentium III 256MB RAM 128MB free HD space Windows 2000 and later Windows Vista Compatible Back to top A 30 day trial version of Absoft Pro Fortran for Windows is available.Back to topCompatibilty and Companion Products Absoft Pro Fortran uses an extended version of the Cray CF90 front end and adheres to the latest ISO and ANSI Fortran 95 standards. Extensions from all major workstations have been added to make sure your code ports from any environment with minimal effort. Absoft Fortran compilers conform to all DoD MIL-STD 1753, FIPS 69-1, and POSIX standards, support most popular VAX/VMS extensions including RECORD, STRUCTURE, POINTER, and UNION, (per V5.4 of VMS FORTRAN), QUAD (REAL*16) data types as well as others from IBM/VS, Cray, Sun FORTRAN as well as FORTRAN 66 conventions. Automatic byte-swapping and full integration with many third party tools means porting code from virtually any environment requires little more than a recompilation without rewriting code. The F95 compiler can operate in F95, F90 or F77 modes. IMSL Fortran Numerical Library available for 64-bit Windows MATFOR 4 Numerical and Visualization Libraries available for 32-bit Windows VAST-F/Parallel - Pre-processor that automatically parallelizes source code STAR-CD - currently requires Absoft Pro Fortran v8.2 for STAR-CD v3.26, same functionality as the v9.0, please contact sales to order. Additional third party products can be found on ISVs and Resources. Back to top Full technical support from professional support engineers who will help resolve any problems is included at no additional charge with each new product from Absoft. To ensure your software continues running at maximum efficiency, all registered Absoft customers can download service packs and quick fixes at no. Fortran function: pointer as actual argument and target as formal. 4. Nullifying Pointers in Fortran. 2. array of pointers fortran. 2. passing pointer arguments in fortran. 2. Pass pointer of child type to dummy argument that takes a pointer of parent class. 2. Fortran pointer to parameter array target. 3.
Procedure pointers in Fortran Wiki
CUDA Fortran is a software compiler and tool chain for building performance optimized GPU-accelerated Fortran applications targeting the NVIDIA GPU platform. GET STARTED Powerful CUDA Fortran includes language extension to simplify data management, the !$cuf kernel directive for automatically generating device code loops, and interface modules to all the NVIDIA CUDA-X math libraries. Flexible CUDA Fortran is designed to interoperate with other popular GPU programming models including CUDA C, OpenACC and OpenMP. You can directly access all the latest hardware and driver features including cooperative groups, Tensor Cores, managed memory, and direct to shared memory loads, and more. Low Risk CUDA Fortran is proven and supported on all major HPC platforms including x86-64, OpenPOWER and Arm-based servers. NVIDIA CUDA Fortran is available for use both on-premises and on all major cloud platforms including NGC. Commercial support options are available. Key Features Direct GPU Programming CUDA Fortran is a low-level explicit programming model with substantial runtime library components that gives expert Fortran programmers direct control over all aspects of GPU programming. CUDA Fortran enables programmers to access and control all the newest GPU features including CUDA Managed Data, Cooperative Groups and Tensor Cores. CUDA Fortran includes several productivity enhancements such as Loop Kernel Directives, module interfaces to the NVIDIA GPU math libraries and OpenACC interoperability features. Access New GPU Features CUDA Fortran gives you access to the latest CUDA features. Using CUDA Managed Data, a single variable declaration can be used in both host and device code. Variables declared with the managed attribute require no explicit data transfers between host and device. Cooperative groups provide the ability to synchronize device threads in groups larger or smaller than thread blocks. Warp-based matrix multiply accumulate operations using Tensor Cores are enabled through the wmma module which provides WMMA API functions for manipulating and operating on matrices. CUDA Library Interfaces CUDA Fortran includes module-defined interfaces to all the CUDA-X math libraries including cuBLAS, cuFFT, cuRAND, cuSOLVER, cuSPARSE, and cuTENSOR, as well as the NCCL and NVSHMEM communications libraries. The NVFORTRAN compiler can seamlessly accelerate many standard Fortran array intrinsics and language constructs including sum, maxval, minval, matmul, reshape, spread, and transpose on device and managed arrays by mapping Fortran statements to the functions available in the NVIDIA cuTENSOR library, a first-of-its-kind, GPU-accelerated, tensor linear algebra library providing tensor contraction, reduction, and element-wise operations. See the NVIDIA Fortran CUDA Library Interfaces documentation for more information. Interoperable Programming Combining CUDA Fortran with other GPU programming models can save time and help improve productivity. For example, you can use CUDA Fortran device and managed data in OpenACC compute constructs. Call CUDA Fortran kernels using OpenACC data present in device memory and call CUDA Fortran device subroutines and functions from within OpenACC loops. Pass device arrays moved using OpenACC data constructs directly to CUDA Fortran kernels. CUDA Fortran and OpenACC can share CUDA streams and can both use multiple devices. CUDA Fortran is also interoperable with OpenMP programs. Kernel Loop Directive CUDA Fortran allows automatic kernel generation andWorking with Pointers (The GNU Fortran Compiler) - Simply Fortran
Window,or from within the Microsoft visual development environment, if you installed the component for Visual Studio integration. To use the Intel® Visual Fortran Compiler from a command window, open the command window from the Intel® Visual Fortran Compiler's menu from [Start]->[All Programs]->[Intel® Software Development Tools]-> [Intel® Fortran Compiler 9.1]->[Build Environment for Fortran IA-32 applications] . It sets up the environment automatically. Or you can open a normal command window and run \Compiler\Fortran\9.1\xxxx\bin\ifortvars.bat.Where xxxx is IA32, EM64T or Itanium. It also sets up the environment correctly to use the Intel Fortran Compiler. If you need to use the Intel C++ Compiler from the same command window, run \Compiler\C++\9.1\xxxx\bin\iclvars.bat Note: ifortvars.bat should be run after iclvars.bat so the linker will pick up the correct Fortran run-time libraries. To use the Intel Fortran Compiler from the Microsoft visual development environment, use the program group item for the installed Microsoft product, for example, Start..Programs..Microsoft Visual Studio 2005..Microsoft Visual Studio 2005. If you have any problems running the compiler, please make sure a valid license file (*.lic) is located in the license directory. The compiler uses the environment variable INTEL_LICENSE_FILE to locate the license file. If you still have problems, please submit an issue to Intel® Premier Support.See the Technical Support section of this document for details. If you have not already done so, please register for support after you install this product. See Technical Support for registration instructions.Setting Up the IMSL* Fortran Libraries Environment (Professional Edition Only)For information on configuring either the command-line or the Visual Studio .NET environment for use with the IMSL* Fortran Libraries, provided in the Professional Edition only, please refer to the sections on using IMSL in the Using Libraries chapter of the Intel Fortran User Manual. Uninstalling or Modifying the Compiler and ToolsTo uninstall or modify Intel Visual Fortran Compiler tools or components, select "Add or Remove Programs" from the "ControlPanel". The following is a complete list of the tools and components whichmay be installed. You may not have all of these installed:Intel(R) Debugger 9.1 Intel(R) License Manager for FLEXlm* Intel(R) Visual Fortran Compiler 9.1 Intel(R) Visual Fortran Compiler 9.1, Extended Memory 64 Technology Edition Intel(R) Visual Fortran Compiler Integration into Microsoft Visual C++ .NET IMSL Library 5.0 for Intel(R) Fortran Compiler 9.1Note: uninstalling the Intel Visual Fortran Compiler does not delete the corresponding license file.Obtaining Technical SupportIf you did not register your compiler during installation, please do so at the Intel® Software Development Products Registration Center. Registration entitles you to free technicalsupport, product updates and upgrades for the duration of the support term. For information about how to find Technical Support, Product Updates, Users Forums, FAQs, tips and tricks, and other support information, please visit: Note: If your. Fortran function: pointer as actual argument and target as formal. 4. Nullifying Pointers in Fortran. 2. array of pointers fortran. 2. passing pointer arguments in fortran. 2. Pass pointer of child type to dummy argument that takes a pointer of parent class. 2. Fortran pointer to parameter array target. 3. Fortran structures and pointers. 1. One pointer for different types Fortran. 1. Fortran: Type containing a member that is an array of elements of this type. 4. Fortran polymorphism in pointers. 3. Fortran pointer attribute to type declarations. 2. How to use structures with pointers in Fortran like in C? 3.Difference in Fortran pointer and Fortran allocatable in calling C_F
The documentation. MRWE, the Absoft application framework, is a native Windows Multiple Document Interface (MDI) Windows program written completely in Fortran. Complete documented source is provided as a tutorial on Windows programming in Fortran. The source may be easily modified and recompiled if additional features or modifications are desired. Back to Special Features The process of combining Fortran and C routines into a single application has been a major frustration to many Windows programmers. Microsoft requires use of non-standard Fortran syntax to accomplish this feat. Absoft Pro Fortrans provide a better solution: Absoft Fortran compilers are link-compatible and use standard Microsoft C calling conventions. Mixed Fortran/C applications are easily generated entirely from within the Pro Fortran development environment or can be easily linked with code created in Microsoft C. Example code is provided in the documentation. Pro Fortran compilers are also debug-compatible with the Microsoft C compiler included with the Microsoft platform SDK.. Back to Special Features Pro Fortran can automatically build Fortran-based DLLs compatible with Microsoft Visual C++, Microsoft Visual BASIC, Microsoft Excel, Delphi, and Borland C++. Example code is contained in the documentation. Absoft's alias feature allows you to create DLLs compatible with any other configuration. Help guide for Visual Basic 6.0 and earlier located here. Help guide for Visual Basic .NET located here. Information on calling unmanaged DLL's from Visual C++ .NET located here. Pro Fortran includes a new, flexible graphics library called PLplot. PLplot can be called from Fortran as well as C, and C++ and can create standard x-y plots, semilog plots, log-log plots, contour plots, 3D plots, mesh plots, bar charts and pie charts. Multiple graphs (of the same or different sizes) may be placed on a single page with multiple lines in each graph. Output can be to your monitor, a file, a printer or in postscript format. There are almost 2000 characters in the extended character set including four different fonts, the Greek alphabet and a host of mathematical, musical and other symbols. PLplot is included on all versions of Pro Fortran and is source compatible across Linux, Windows and Mac platforms (additional details available at: HDF precompiled libraries are included with every copy of Pro Fortran. Back to Special Features Absoft manufactures high performance Fortran compiler suites for Windows, Macintosh(OS9 and OS X), Intel/Linux and PPC/Linux based systems. Absoft compiler suites are source compatible across the different platforms which means inComments
PROCEDURE statement in the derived type declaration, the developer can make the "this" argument to be second, third, or wherever appropriate on the dummy argument list; it doesn't have to be first. Also, the argument can be named "this", "self", "me", etc. - whatever naming convention is preferred. Izaak Beekman wrote:...If one were to give the TBP/procedure-pointer component the nopass attribute then the procedure could be invoked explicitly passing the object: obj%method(obj). ...In such a case, the invocation becomes analogous to that of a conventional Fortran subprogram: CALL method(obj,..) in the case of a subroutine and foo = method(obj,..) for a function. Izaak Beekman wrote:Yeah, how they arrived at some of the finer points of the syntax for procedure pointer components really seems non-intuitive to me.Things start to make a little bit of sense to me when I consider what would be required for consistency with legacy FORTRAN. I assume that is what the Fortran 2003 standard writers had to contend with, trying to add new features while retaining syntax that, at a base level, is not alien to how it has been done since FORTRAN IV perhaps, or definitely FORTRAN 77. Considering all the constraints that any standards body would normally face and when one piles all the legacy stuff on top of it, I think Fortran 2003 creators did a remarkable job. But for many Fortran 2003 and 2008 features, I don't think I'll be writing any new code in Fortran! Thank you all for enlightening discussions on this subject. The code provided by FortranFan works like a charm. I have to admit that I would have never be able guess the correct syntax in this case, regardless of the modern FORTRAN bibliography worldwide available. The most puzzling for me is the presence of 'this' at lines 4, 8 and 12.RakFortranFan wrote:Quote:jimdempseyatthecove wrote: ... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface? ... Jim,Is the functionality shown in the code below what you're asking about? It is standard Fortran. module pcf_mod type ::
2025-03-24Type related lines it compiles fine. It seems that I am stuck.Rak As you found out, you have to use a derived type here. Fortran doesn't have the notion of an array of pointers.The new error is simply a compiler bug. For some reason it thinks you're declaring a type-bound procedure, which you aren't. That's just weird - I will report it to the developers. Steve Lionel (Intel) wrote:The new error is simply a compiler bug. For some reason it thinks you're declaring a type-bound procedure, which you aren't. That's just weird - I will report it to the developers.Steve, according to Fortran 95/2003 by M,R,C this is correct behavior: When a procedure pointer component (or a type-bound procedure, Section 16.6) is invoked the object through which it is invoked is normally passed to the procedure as its first actual argument and the items in the parenthesized list are the other actual arguments. This could be undesirable; for instance, it might be wished to pass the object to a dummy argument other than the first or not to pass it at all.Therefore, I don't think this is a compiler bug. For the OP to get the intended behavior, simply add the nopass attribute to the procedure pointer declaration in the derived type: type :: ARRPROCPOINTER procedure(USERFUNC_int), pointer, nopass :: pcf end type ARRPROCPOINTER Well, I'll be darned. I'm always learning something new about this language.... Indeed you are correct, Zaak. Yeah, how they arrived at some of the finer points of the syntax for procedure pointer components really seems non-intuitive to me. Zaak,Assuming the nopass technique corrects the compiler complaint of compliance to the standard... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface?Jim Dempsey jimdempseyatthecove wrote:Zaak,Assuming the nopass technique corrects the compiler complaint of compliance to the standard... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface?Jim DempseyJim, I'm not sure what you mean by the "this" pointer. If the user
2025-03-24Hi,I am trying to construct a static array of procedure pointers like this: abstract interface function USERFUNC_int (arg) integer USERFUNC_int integer, intent(IN) :: arg end function USERFUNC_int end interface procedure(USERFUNC_int), pointer :: pcfs(100) but the compiler complains about the "(":error #5082: Syntax error, found '(' when expecting one of: , ; => procedure(USERFUNC_int), pointer :: pcfs(100)It is possible to declare a static array of procedure pointers? I am using ifort 13.1.3.0.Thanks,Rak Intel® Fortran Compiler 1 Solution jimdempseyatthecove wrote:... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface?...Jim,Is the functionality shown in the code below what you're asking about? It is standard Fortran. module pcf_mod type :: ARRPROCPOINTER procedure(USERFUNC_int), pointer, pass(this) :: pcf end type ARRPROCPOINTER abstract interface function USERFUNC_int (arg, this) import :: ARRPROCPOINTER integer USERFUNC_int integer, intent(IN) :: arg class(ARRPROCPOINTER) :: this end function USERFUNC_int end interface type(ARRPROCPOINTER) :: pcfs(100) end module pcf_mod program p .. integer :: i, j, k .. pcfs(i)%pcf => foo .. k = pcfs(i)%pcf(j) .. end program pNote how the interface has been changed to refer to the invoking object via the "this" dummy argument. You may also know that by using the PASS attribute in the PROCEDURE statement in the derived type declaration, the developer can make the "this" argument to be second, third, or wherever appropriate on the dummy argument list; it doesn't have to be first. Also, the argument can be named "this", "self", "me", etc. - whatever naming convention is preferred. All forum topics Previous topic Next topic 13 Replies Moreover, if I am trying to circumvent the problem by embedding the function pointer into a derived type as follows module pcf_mod abstract interface function USERFUNC_int (arg) integer USERFUNC_int integer, intent(IN) :: arg end function USERFUNC_int end interface type :: ARRPROCPOINTER procedure(USERFUNC_int), pointer :: pcf end type ARRPROCPOINTER type(ARRPROCPOINTER) :: pcfs(100) end module pcf_modI am getting a totally unrelated compiler error:error #8262: The passed-object dummy argument must be dummy data object with the same declared type as the type being defined. [ARG] function USERFUNC_int (arg)Removing the
2025-03-25Did want to pass the object as an actual argument to type bound procedure (TBP) or procedure being pointed to by the procedure pointer component, then the canonical way of doing this is to specify the first dummy argument of the procedure as being type-compatible with the encompassing "this" object and without adding any pass or nopass attributes to the component specification. If the procedure had only this one dummy argument, then when it is invoked via the TBP or procedure-pointer component, the encompassing object is implicitly passed as the first actual argument, and the user can invoke the procedure with no (explicit) actual arguments. e.g., obj%method(). If one were to give the TBP/procedure-pointer component the nopass attribute then the procedure could be invoked explicitly passing the object: obj%method(obj). These two scenarios are identical. In general I think explicit is better than implicit, but in this context it is reasonable to expect a procedure bound to an object to modify the objects state and appreciate the decrease in verbosity associated with this language feature.So, if I correctly understand your question, the answer is 'yes.' At any rate, between this post and Fortran Fan's hopefully we've covered the ins and outs of the pass(_____) and nopass attribute, and objects implicitly or explicitly passed as actual arguments to their TBPs/procedure-pointer components. jimdempseyatthecove wrote:... And assume the user wishes to pass the "this" pointer... Could the user then explicitly declare the "this" pointer in the function interface?...Jim,Is the functionality shown in the code below what you're asking about? It is standard Fortran. module pcf_mod type :: ARRPROCPOINTER procedure(USERFUNC_int), pointer, pass(this) :: pcf end type ARRPROCPOINTER abstract interface function USERFUNC_int (arg, this) import :: ARRPROCPOINTER integer USERFUNC_int integer, intent(IN) :: arg class(ARRPROCPOINTER) :: this end function USERFUNC_int end interface type(ARRPROCPOINTER) :: pcfs(100) end module pcf_mod program p .. integer :: i, j, k .. pcfs(i)%pcf => foo .. k = pcfs(i)%pcf(j) .. end program pNote how the interface has been changed to refer to the invoking object via the "this" dummy argument. You may also know that by using the PASS attribute in the
2025-04-15Subject to license terms and policies of their respective manufacturers. Please contact Absoft directly for further details or questions on Technical Support or Software Maintenance. Disclaimer: Premier Technical Support cannot be used as a tutorial to assist in the design and development of applications, use of programs in other than their specified operating environment, provide instructions on general system operation or explore failures caused by products for which Absoft is not responsible under this agreement. MaxFlex· Flexible Licensing available: Yes Floating Network Licenses available: Yes Copy and use on home/portable computer: Yes. Absoft's no charge companion home license policy allows registered users to install Fortran 95 on their home system at no additional charge. Volume orders: Yes. Contact Absoft sales directly. Back to top Recommended Minimum Pentium III 256MB RAM 128MB free HD space Windows 2000 and later Windows Vista Compatible Back to top A 30 day trial version of Absoft Pro Fortran for Windows is available.Back to topCompatibilty and Companion Products Absoft Pro Fortran uses an extended version of the Cray CF90 front end and adheres to the latest ISO and ANSI Fortran 95 standards. Extensions from all major workstations have been added to make sure your code ports from any environment with minimal effort. Absoft Fortran compilers conform to all DoD MIL-STD 1753, FIPS 69-1, and POSIX standards, support most popular VAX/VMS extensions including RECORD, STRUCTURE, POINTER, and UNION, (per V5.4 of VMS FORTRAN), QUAD (REAL*16) data types as well as others from IBM/VS, Cray, Sun FORTRAN as well as FORTRAN 66 conventions. Automatic byte-swapping and full integration with many third party tools means porting code from virtually any environment requires little more than a recompilation without rewriting code. The F95 compiler can operate in F95, F90 or F77 modes. IMSL Fortran Numerical Library available for 64-bit Windows MATFOR 4 Numerical and Visualization Libraries available for 32-bit Windows VAST-F/Parallel - Pre-processor that automatically parallelizes source code STAR-CD - currently requires Absoft Pro Fortran v8.2 for STAR-CD v3.26, same functionality as the v9.0, please contact sales to order. Additional third party products can be found on ISVs and Resources. Back to top Full technical support from professional support engineers who will help resolve any problems is included at no additional charge with each new product from Absoft. To ensure your software continues running at maximum efficiency, all registered Absoft customers can download service packs and quick fixes at no
2025-03-27CUDA Fortran is a software compiler and tool chain for building performance optimized GPU-accelerated Fortran applications targeting the NVIDIA GPU platform. GET STARTED Powerful CUDA Fortran includes language extension to simplify data management, the !$cuf kernel directive for automatically generating device code loops, and interface modules to all the NVIDIA CUDA-X math libraries. Flexible CUDA Fortran is designed to interoperate with other popular GPU programming models including CUDA C, OpenACC and OpenMP. You can directly access all the latest hardware and driver features including cooperative groups, Tensor Cores, managed memory, and direct to shared memory loads, and more. Low Risk CUDA Fortran is proven and supported on all major HPC platforms including x86-64, OpenPOWER and Arm-based servers. NVIDIA CUDA Fortran is available for use both on-premises and on all major cloud platforms including NGC. Commercial support options are available. Key Features Direct GPU Programming CUDA Fortran is a low-level explicit programming model with substantial runtime library components that gives expert Fortran programmers direct control over all aspects of GPU programming. CUDA Fortran enables programmers to access and control all the newest GPU features including CUDA Managed Data, Cooperative Groups and Tensor Cores. CUDA Fortran includes several productivity enhancements such as Loop Kernel Directives, module interfaces to the NVIDIA GPU math libraries and OpenACC interoperability features. Access New GPU Features CUDA Fortran gives you access to the latest CUDA features. Using CUDA Managed Data, a single variable declaration can be used in both host and device code. Variables declared with the managed attribute require no explicit data transfers between host and device. Cooperative groups provide the ability to synchronize device threads in groups larger or smaller than thread blocks. Warp-based matrix multiply accumulate operations using Tensor Cores are enabled through the wmma module which provides WMMA API functions for manipulating and operating on matrices. CUDA Library Interfaces CUDA Fortran includes module-defined interfaces to all the CUDA-X math libraries including cuBLAS, cuFFT, cuRAND, cuSOLVER, cuSPARSE, and cuTENSOR, as well as the NCCL and NVSHMEM communications libraries. The NVFORTRAN compiler can seamlessly accelerate many standard Fortran array intrinsics and language constructs including sum, maxval, minval, matmul, reshape, spread, and transpose on device and managed arrays by mapping Fortran statements to the functions available in the NVIDIA cuTENSOR library, a first-of-its-kind, GPU-accelerated, tensor linear algebra library providing tensor contraction, reduction, and element-wise operations. See the NVIDIA Fortran CUDA Library Interfaces documentation for more information. Interoperable Programming Combining CUDA Fortran with other GPU programming models can save time and help improve productivity. For example, you can use CUDA Fortran device and managed data in OpenACC compute constructs. Call CUDA Fortran kernels using OpenACC data present in device memory and call CUDA Fortran device subroutines and functions from within OpenACC loops. Pass device arrays moved using OpenACC data constructs directly to CUDA Fortran kernels. CUDA Fortran and OpenACC can share CUDA streams and can both use multiple devices. CUDA Fortran is also interoperable with OpenMP programs. Kernel Loop Directive CUDA Fortran allows automatic kernel generation and
2025-03-28