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

Use module

JohnNichols
Valued Contributor III
353 Views

I am a bit lost, with the MNIST program I added a base module to hold all of the parameters.  

There is one module subroutine 

 module subroutine load_mnist(training_images, training_labels, &
                               validation_images, validation_labels, &
                               testing_images, testing_labels)
    use Base
    real, allocatable, intent(in out) :: training_images(:,:)
    real, allocatable, intent(in out) :: training_labels(:)
    real, allocatable, intent(in out) :: validation_images(:,:)
    real, allocatable, intent(in out) :: validation_labels(:)
    real, allocatable, intent(in out), optional :: testing_images(:,:)
    real, allocatable, intent(in out), optional :: testing_labels(:)

    !integer, parameter :: dtype = 4 ! image_size = 784
   ! integer, parameter :: num_training_images = 50000
   ! integer, parameter :: num_validation_images = 10000
  !  integer, parameter :: num_testing_images = 10000

that caused the previous crash I wrote about.  Only in this module had I left the parameters to avoid the crash.  Whilst I am waiting for a long run, I thought I would try and tidy up this problem.  

I added base to the module so the integer parameters are now visible in two places, it ran perfectly with no errors, I commented out the parameters and it still runs, it is running now.  

I find this interesting behaviour as it makes no sense.  

Am I missing something? 

 

0 Kudos
1 Reply
Steve_Lionel
Honored Contributor III
347 Views

Local declarations in the module procedure hide those at the module level. This is the normal rule of host association.

0 Kudos
Reply