Giter VIP home page Giter VIP logo

Comments (10)

mpagowski avatar mpagowski commented on July 23, 2024

should be
utctime=datetime(year=2013,month=1,day=1)
but won't compile anyway

from datetime-fortran.

milancurcic avatar milancurcic commented on July 23, 2024

This compiler message usually implies that the calling signature in the constructor call does not match its interface. And because it doesn't, the compiler tries to default structure constructor, which doesn't work because components are declared private.

This program compiles OK for me:

program test

  use iso_fortran_env, only: real64
  use datetime_module, only: datetime, timedelta

  implicit none

  type(datetime) :: utctime

  utctime = datetime(2013, 1, 1, tz=-5._real64)
  utctime = datetime(year=2013, month=1, day=1)
  utctime = datetime(2013, 1, 1)

end program test

but tested with ifort 18:

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.0.128 Build 20170811
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

I don't have v17 at hand so I can't test it right now.

Be extra careful when passing tz argument to the constructor, as of right now, it has to match the real64 kind size:

utctime = datetime(2013, 1, 1, tz=-5._real64)

from datetime-fortran.

mpagowski avatar mpagowski commented on July 23, 2024

made some progress after added
use iso_fortran_env, only: real64
and corrected tz
with Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.0.128 Build 20170811
Still this error because of some mp stuff
test.o: In function MAIN__': test.f90:(.text+0x63): undefined reference to mod_datetime_mp_datetime_constructor_'

from datetime-fortran.

milancurcic avatar milancurcic commented on July 23, 2024

OK, it looks like all that is left is to link to datetime properly:

ifort test.f90 /path/to/datetime/libdatetime.a -ldatetime

from datetime-fortran.

mpagowski avatar mpagowski commented on July 23, 2024

I have that, it is some odd issue
ifort -c -L/apps/codes/datetime-fortran/build/lib -ldatetime -I/apps/codes/datetime-fortran/build/include test.f90

from datetime-fortran.

milancurcic avatar milancurcic commented on July 23, 2024

What does ifort say?

from datetime-fortran.

mpagowski avatar mpagowski commented on July 23, 2024

ifort 18 compiles fine except some problem with linking to the library that is being sorted out (may be related to mpi ifort on my computer)

ifort 17 fails like below

Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.5.239 Build 20170817

PROGRAM test

USE iso_fortran_env, ONLY: real64
USE datetime_module, ONLY: datetime, timedelta

IMPLICIT NONE

TYPE(datetime) :: utctime

INTEGER :: i,j

utctime=datetime(year=2013,month=1,day=1,tz=-5._real64)
utctime=datetime(2013,1,1)

! utctime=utctime%utc()

END PROGRAM test

USE datetime_module, ONLY: datetime, timedelta
------^
test.f90(8): error #6406: Conflicting attributes or multiple declaration of name. [DATETIME]
TYPE(datetime) :: utctime
-------^
test.f90(12): error #6404: This name does not have a type, and must have an explicit type. [UTCTIME]
utctime=datetime(year=2013,month=1,day=1,tz=-5._real64)
--^
test.f90(12): error #6406: Conflicting attributes or multiple declaration of name. [DATETIME]
utctime=datetime(year=2013,month=1,day=1,tz=-5._real64)
----------^
test.f90(13): error #6406: Conflicting attributes or multiple declaration of name. [DATETIME]
utctime=datetime(2013,1,1)
----------^
test.f90(4): error #6580: Name in only-list does not exist. [DATETIME]
USE datetime_module, ONLY: datetime, timedelta
-----------------------------^
test.f90(4): error #6580: Name in only-list does not exist. [TIMEDELTA]
USE datetime_module, ONLY: datetime, timedelta
---------------------------------------^
compilation aborted for test.f90 (code 1)

from datetime-fortran.

mpagowski avatar mpagowski commented on July 23, 2024

I need to check it again fort ifort 17, will try again later and post errors

from datetime-fortran.

mpagowski avatar mpagowski commented on July 23, 2024

I figured the problem. intel 17 and 18 will both compile. If I can I would suggest one extension to the library in terms of generic functions: it would be beneficial to code datetime so it works with
datetime(year=2013,month=1,day=1,tz=-5._real64),
datetime(year=2013,month=1,day=1,tz=-5.), etc. i.e. tz as a real or an integer.
Thanks for your patience.

from datetime-fortran.

milancurcic avatar milancurcic commented on July 23, 2024

It would be straightforward to make the constructor generic to allow various kinds for tz argument. But this would increase the code size considerable for a feature with such small surface area. Unless there are more requests for it I'm not inclined to make it generic.

from datetime-fortran.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.