Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

how could that open, please do me a favor

Liu_Z_2
Beginner
1,101 Views

hi, all

when building, the read_h2osoi.F90  the subroutine scatter_data_from_master of spmdGathScatMod.F90. There is always a mistake: error #6285: There is no matching specific subroutine for this generic subroutine call.   [SCATTER_DATA_FROM_MASTER]

And I call read_h2osoi.F90 in the clm_driver.F90.

Could you help me to find the reason.

Thanks in advance.

0 Kudos
7 Replies
Steven_L_Intel1
Employee
1,101 Views

While this code requires many modules not supplied in order to compile, I think the problem is that in the specific scatter_1darray_real, the array arguments are declared as pointers, for no good reason that I can see. Since the actual arguments in the calls are not pointers, this is not allowed in Fortran 2003, either for a specific call or a generic. Fortran 2008 relaxes this somewhat, but we don't yet support this relaxation. I note that gfortran gives a similar error.

My advice to you is that the POINTER attribute is unnecessary and inappropriate in this circumstance. Perhaps the author believed that any time a dummy argument was deferred shape, with (:) bounds, it had to be POINTER - this is NOT true.

0 Kudos
Liu_Z_2
Beginner
1,101 Views

Dear Steve,

Thank you for you reply. So you mean, in the read_h2osoi.F90, there is no need to give the arguments "h2osoi_g(:,:), h2osoi_vol(:,:)" POINTER attribute, and it is wrong?

Then how could I correct the subroutine "read_h2osoi.F90" written by me to make it build successfully, thank you very much.

Best regards.

Sincerely,

Zhen

0 Kudos
Steven_L_Intel1
Employee
1,101 Views

Since I don't have all the sources, I can't promise that it will build correctly, but I think you can and should remove the POINTER attribute from those dummy arguments and see if it works. It certainly will not work with POINTER there.

0 Kudos
Liu_Z_2
Beginner
1,101 Views

Dear Steve,

Thank you for your quick reply. Because the codes are part of a model. They run with calling each other, so I pass all the possible module to you. After I remove the POINTER attribute, there is another mistake :/users/essljn/lz/cesm1_2_0/models/lnd/clm/src/clm4_0/main/clm_driver.F90(301): error #6911: The syntax of this substring is invalid.   [H2OSOI_VOL] allocate(h2osoi_vol(begc:endc,1:nlevgrnd)).

What do you think of that? Thank you very much.

It is getting late in China. It is 2:00. I would go to bed.

 

With best regards,

Sincerely,

Zhen

0 Kudos
Steven_L_Intel1
Employee
1,101 Views

I was not suggesting that POINTER be removed everywhere, only in the declaration of dummy arguments where you're not doing allocates, deallocates or pointer assignment. From the small bit of code you sent, I don't see pointer assignment so arrays such as h2osoi_g could be better declared allocatable rather than pointer, though pointer works there. It's just for the dummy arguments in procedures where you don't want to use POINTER unless you are going to be doing allocate/deallocate/pointer assignment.

0 Kudos
Liu_Z_2
Beginner
1,101 Views

Dear Steve,

Thank for your reply. And I get a little confused about where I should change. I am not sure which file you refer, read_h2osoi.F90 or clm_driver.F90.

Of course, please forgive me, I have not described the problem clearly. I put read_h2osoi.F90 in the clm_driver.F90. If possible, could you teach me how to change the clm_driver.F90 directly.

And the attachment is consists of the modified clm_driver.F90 by me in the last time and all the modules I consider to be used. But I also can not build  it. The mistake is:

/users/essljn/lz/cesm1_2_0/models/lnd/clm/src/clm4_0/main/clm_driver.F90(323): error #7121: A ptr dummy may only be argument associated with a ptr, and this array element or section does not inherit the POINTER attr from its parent array.   [H2OSOI_VOL]
  call scatter_1darray_real(h2osoi_vol(begc:endc,k), h2osoi_g(1:numg,k), clmlevel)
----------------------------^
/users/essljn/lz/cesm1_2_0/models/lnd/clm/src/clm4_0/main/clm_driver.F90(323): error #7121: A ptr dummy may only be argument associated with a ptr, and this array element or section does not inherit the POINTER attr from its parent array.   [H2OSOI_G]
  call scatter_1darray_real(h2osoi_vol(begc:endc,k), h2osoi_g(1:numg,k), clmlevel)
-----------------------------------------------------^
/users/essljn/lz/cesm1_2_0/models/lnd/clm/src/clm4_0/main/clm_driver.F90(742): error #6691: A pointer dummy argument may only be argument associated with a pointer.   [H2OSOI_VOL]
     call read_h2osoi(nstep, h2osoi_vol)   ! liuzhen added
-----------------------------^
compilation aborted for /users/essljn/lz/cesm1_2_0/models/lnd/clm/src/clm4_0/main/clm_driver.F90 (code 1)

If you need other code, please tell me.

Thank you very much!

With best regards.

Sincerely,

Zhen

0 Kudos
Steven_L_Intel1
Employee
1,101 Views

I'm sorry, but I've gone as far as I will with helping you correct your code. Someone (you?) added POINTER in many places it wasn't allowed. I told you how to fix the generic resolution problem. This application, since it uses ALLOCATE, will need POINTER or ALLOCATABLE in the places where the arrays are allocated or deallocated, but probably not elsewhere. It sounds as if you are not very familiar with the Fortran language and are making "random" changes to the code that you don't understand. You have a very large application and I'm not able to take the time to lead you through the steps to correct it, even assuming I understood what the application was trying to do.

Perhaps you should go back to the way it was originally, before the errors were introduced, and then think carefully about what changes you want to make.

0 Kudos
Reply